SQL_CALC_FOUND_ROWS isn't an option for us. Right now I am doing two queries, but I am just trying to see if there is a better way to do the count query than to just turn it into a dervied table and count the results i.e. SELECT COUNT(*) FROM (big nasty query) t1. I think what the question is boiling down to is how to do count queries when using group by and/or having clauses.

Les

Perrin Harkins wrote:
On 8/1/07, Jerry Schwartz <[EMAIL PROTECTED]> wrote:
Will SELECT SQL_CALC_FOUND_ROWS and SELECT FOUND_ROWS() do what you want?

Be careful.  While it will give the correct number of rows that would
have been found if LIMIT had not been used, it makes the server
compute the whole result set, disabling the shortcuts that LIMIT
normally allows.  I found that with my large queries it was faster to
do two separate queries (a COUNT for the number of rows and a LIMIT
for one page of results) than to use LIMIT and FOUND_ROWS().

- Perrin

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to