Clodo wrote: > Many thanks, it's a good news that resolve my problem. > > But still remain "a trick", i think the behaviour descripted in my > original feedback is "strange".. i understand, if all fields have the > same value, an index on that have a zero "height" in computing the best > indexes to use, but not use index at all and do a full-table-scan, for > what i understand about sqlite, imho is strange... > If an index is useless for the query, then a full table scan will generally be quicker than an indexed scan.
An indexed scan requires accessing two things (the index plus the data) and also traversing the index which is more 'random access' than sequentially scanning through the table. If the analyse has analysed the right data, then letting it do the table scan is probably the best thing. If it hasn't, then put the right data in the table before doing the analyse... (PostgreSQL does the same thing, if the index is useless, or the database clustering is highly correlated with the index, then it won't use the index at all). _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users