Thank you very much for your reply, Igor. The explanation you made is only valid for sqlite or for SQL in general?
Moreover, the query: select * from mytable where X=?; would still benefit the index on (X, Y, Z)? --- Igor Tandetnik <[EMAIL PROTECTED]> wrote: > "L B" <[EMAIL PROTECTED]> wrote in > message > news:[EMAIL PROTECTED] > > I would like to know if there is any difference > > between using 3 indexes on three different fields > or > > just an index which groups them, in terms of > physical > > size and performance. > > Yes. In both cases, there are queries that will > benefit from such > indexes, and queries that won't be able to use them. > > > I have seen that sqlite cannot use more than one > index > > at a time, so I was wondering if the second option > is > > always the best solution. > > Not always. If you have a single index on (X, Y, Z), > it can't be used > for queries like > > select * from mytable where Y=?; > select * from mytable where Z=?; > > for the same reason that the sort order in a > dictionary doesn't help you > find all words whose second letter is 'a'. > > Igor Tandetnik > > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users