It calls the xBestIndex method instead. However, the virtual table module cannot determine which (if any) fields will be selected and must act solely upon the passed constraints. Unless you are willing to implement a virtual field and write something like "SELECT <list> FROM vtable WHERE <conditions> AND __fieldlist='<list>';" then the virtual table implementation is stuck with retrieving all fields of the base native table (or at least sufficient data to be able to generate all fields of the virtual table). Alternatively it is sometimes possible to implement __image (memory address of record) and __column (Entrypoint for calling the xColumn method) virtual fields to generate column values "as needed", but care must be taken to ensure that memory addresses remain valid (e.g. if the base virtual table has a single record buffer for reading from a file, then all addresses will be identical; but the contents reflect the last record read if the statement requires a sort operation).
-----Ursprüngliche Nachricht----- Von: Dominique Devienne [mailto:ddevie...@gmail.com] Gesendet: Mittwoch, 27. November 2013 09:45 An: General Discussion of SQLite Database Betreff: Re: [sqlite] count (*) performance On Wed, Nov 27, 2013 at 9:35 AM, Clemens Ladisch <clem...@ladisch.de> wrote: > veeresh kumar wrote: > > I see that in release history for 3.8.1 below item. > > "Estimate the sizes of table and index rows and use the smallest > applicable B-Tree for full scans and "count(*)" operations." > > > > Does it mean that performance of count(*) has been improved in 3.8.1 > > Yes. > > > and if yes by how much? > > That depends on how much the rows of your smallest index are smaller > than the rows of the table. > What about vtables? How does SQLite estimate the size of table and index rows for vtables? Sometimes vtables are based on native containers which know their size, thus it's an O(1) op, but the vtable has no way to communicate that size to the engine to bypass an O(N) full scan? Any chance the vtable API would allow such shortcuts? Thanks, --DD _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -------------------------------------------------------------------------- Gunter Hick Software Engineer Scientific Games International GmbH Klitschgasse 2 – 4, A - 1130 Vienna, Austria FN 157284 a, HG Wien Tel: +43 1 80100 0 E-Mail: h...@scigames.at This e-mail is confidential and may well also be legally privileged. If you have received it in error, you are on notice as to its status and accordingly please notify us immediately by reply e-mail and then delete this message from your system. Please do not copy it or use it for any purposes, or disclose its contents to any person as to do so could be a breach of confidence. Thank you for your cooperation. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users