> On 14/12/2014, at 4:17 am, Simon Slavin <slav...@bigfraud.org> wrote: > > > On 13 Dec 2014, at 12:38pm, Richard Hipp <d...@sqlite.org> wrote: > >> Also, if there are indices available, SQLite attempts to count the smallest >> index (it has to guess at which is the smallest by looking at the number >> and declared datatypes of the columns) and counting the smallest index >> instead, under the theory that a smaller index will involve less I/O. > > Would it not be faster to just count the number of pages each index takes up > ? Uh ... no. > Wow. You really don't like storing counts or sizes, do you ?
That wouldn't work, because leaf nodes in a B-tree contain a variable number of used entries. It is necessary to visit each leaf node to find out how many entries that page contains. The reason for using the "smallest" index is that each leaf node will hopefully cover more records than the leaf nodes from the main table, therefore less I/O is required. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users