Let's say I have a really big table filled with a lot of data (let's say enough to not fit comfortably in memory), and I want to analyze a subset of the rows.
This usually happens faster:
SELECT (column1, column2, ... , columnN) FROM table WHERE (some complicated boolean clause);
and then use a ResultSet, or it can be done faster:
SELECT (column1, column2, ... , columnN) FROM table;
and then iterate over the ResultSet, taking different strings based on the java version of your logical condition?
I think it comes down to whether the Java iterator / Boolean evaluator is faster than the MySQL logical evaluator.
source
share