Hi,

Background is, that I want to implement my paging entirely in sql in order to save memory, because the complete result-data consumes a lot of memory.

Question is: Why isn't there a way like the FOUND_ROWS()-function of MySQL (I didn't find any reading the docs and googling), to get the amount of rows a query would have returned if it had been executed without specifying a limit-clause?

Doing the same query again (using count() and without sorting) is a lot faster than the original, limited query, but still I have queries where this takes about 1 second to execute and thus affects user-experience. To be honest it is 4 seconds for the normal query + 1 seconds for the count-query so it is not a show-stopper, however it seems to me, that this 1 second could be avoided easily in some cases..

I understand, that the total-count-value may not be internally available in all cases without doing some calculations that might affect performance when the value is not needed, but I'm pretty sure, that it should be easily available in many cases, e.g. when the query has an order-by-clause before the limit-clause..

As all my queries for the paging do an order-by, I'm pretty sure a "total_rows()"-functions that only yields a value when it can be calculated easily or a pragma to turn the feature on and off would serve me well enough..


Cheers, Daniel


--
Dipl.-Inf. Daniel Hofmann
Axivion GmbH
Nobelstr. 15
70569 Stuttgart
Germany
Tel: +49 711 6204378-44
Fax: +49 711 6204378-99

Geschaeftsfuehrung: Stefan Bellon, Thomas Eisenbarth, Sebastian Rummler
Sitz der Gesellschaft: Stuttgart
Registergericht: Amtsgericht Stuttgart, HRB 720590

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to