If I use the LIMIT clause without using
SQL_CALC_FOUND_ROWS in a non-UNION statement, MySQL
returns the number of rows found up to the LIMIT.
Using SQL_CALC_FOUND_ROWS forces MySQL to keep going
on checking all hits, and that affects performance.
However, if I use the LIMIT clause at the end of a
UNION query, MySQL returns the number of all matches
even if I don't use SQL_CALC_FOUND_ROWS!
This is causing performance problems because I want
MySQL to stop counting all the matches as soon as it
finds hits matching the limit.
How do I force MySQL quit calculating all the hits and
stick to the LIMIT clause in UNION queries?
In other words, how do I force my SQL to execute the
UNION statement the same way it executes a non-UNION
statement with a LIMIT clause but no
SQL_CALC_FOUND_ROWS?
I appreciate your help.
Homam