Code:
(
SELECT SQL_CALC_FOUND_ROWS
[...] - 12 rows
FROM `produs`
)
UNION ALL
(
SELECT
[...] - 12 rows
FROM `produs_lgp` AS `produs`
)
ORDER BY `row3`
LIMIT 0,25
`produs` has - 30000+ rows
`produs_lgp` has - 120000+ rows
in the attached picture (screen_explain.gif) you will see an EXPLAIN statement result of the query above. can someone tell me from that explain if something is wrong? i don't understand why the query takes 20 seconds to execute (i've tried different my.cnf configurations and got nearly same results)
[later edit]
- i use UNION ALL for FOUND_ROWS
- i use SELECT SQL_CALC_FOUND_ROWS because later i use SELECT FOUND_ROWS() for pagination, getting the number of total results. i also noticed that in the whole script (that is running this queries) the part with "SELECT FOUND_ROWS()" takes a lot of time..
[/later edit]