On 2014年5月8日 GMT+08:00PM9:14:52, Clemens Ladisch <clem...@ladisch.de> wrote: >Woody Wu wrote: >> On 2014年5月8日 GMT+08:00AM1:51:43, Clemens Ladisch <clem...@ladisch.de> >wrote: >>> Simon Slavin wrote: >>>> You can let SQLite make a better estimate by using the 'ANALYZE' >>>> command. >>> >>> Yes. However, even if a better estimate were to show that this >index is >>> not very useful, there would exist, at the moment, no better index >(with >>> id1 or id2 as the first indexed column). >> >> Do you mean that my index for this case is already the best choice? > >No. In a database that has only this index, it is the only choice. >But you should create a better index. > >> And, as a general question, for a query in the form of >> select max(a) from table where a < InF and b=B and c=C. >> what's the best index in the case of (1) B is an existed one, or (2) >B is not exists ? > >That depends. Create two indexes on (b,c,a) and (c,b,a), run ANALYZE, >and check which one gets actually used. > > >Regards, >Clemens >_______________________________________________ >sqlite-users mailing list >sqlite-users@sqlite.org >http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Thanks Clemen, could you please tell me how to use this analyze command for the case? I dont get the point from the manual. -Woody Wu _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users