Hello,
I'm using Views2 and there is a query with big time execution. This query is
$count_query = 'SELECT COUNT(*) FROM (' . str_replace(array_keys($replacements), $replacements, $count_query) . ') count_alias'; (line 676 in include/view.inc)
I have three LEFT JOIN statements in subquery. If i execute the same query which is constructed as
'SELECT COUNT(*) FROM .... WHERE ...' it would be executed 3 times faster.
Is it possible to construct count query in such way or there is a reason to use subquery for counting?
(Also in dev version it's constructed: line 898 query.inc and line 646 in view.inc)
Thank you.
Comments
Comment #1
grafsl commentedExcuse me for the mistake in the title. Please, change 'constraction' on 'construction'.
Comment #2
merlinofchaos commentedIn the past, I've had problems with the generation of the count query, especialy when a GROUP BY becomes involved. This form of count query is bullet proof and will always generate the correct data.