Hi! On Dec 05, tk wrote: > Hello Sergei, Gunnar, and others, > > thank you for your quick responses. > One little mystery remains: > > Why does one need to read all the row data (with > SQL_CALC_FOUND_ROWS) to get the total number of > results when using a limit? > > When the index is used to find relevant rows and sort > the results, the code certainly must know how many > total results there are.
Yes, but it's different code, it works on a different level and knows nothing about SQL_CALC_FOUND_ROWS :( > Could one not store the total while using the index > and use "select FOUND_ROWS()" without > SQL_CALC_FOUND_ROWS to retrieve the total? Yes, it could. It is the optimization that wasn't implemented yet. (but it's in the TODO) Regards, Sergei -- __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Sergei Golubchik <[EMAIL PROTECTED]> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer /_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]