I'm wondering if sqlite has something similar to MySQL's SQL_CALC_FOUND_ROWS. I'm sorry if this topic has been discussed before, but I've searched the archives and found no final decision made about it yet...
Mahmoud Al Gammal
This message was sent from a MailNull anti-spam account. You can get
your free account and take control over your email by visiting the
Mahmoud Al Gammal wrote:
> I'm wondering if sqlite has something similar to MySQL's
> SQL_CALC_FOUND_ROWS. I'm sorry if this topic has been discussed
> before, but I've searched the archives and found no final decision
> made about it yet...
With SQLite, there's no point doing that. You may just as well run the
query without LIMIT clause.
In MySQL, SQL_CALC_FOUND_ROWS works essentially by running the full
query as if issued without the LIMIT clause, but then only sending first
X records over to the client. The time saving comes from not sending
extra data over the wire, not from more efficient query execution.
SQLite works in-process and does not read the column data until you
explicitly request it. To imitate SQL_CALC_FOUND_ROWS, simply run the
query without LIMIT, read the actual data from the first X rows then
simply step through the rest to count them.