On 12/10/08, L B <[EMAIL PROTECTED]> wrote: > Hi all, > > 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. > 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.
Let's say you have a table like so CREATE TABLE foo (a, b); and, (a, b) are unique combinations. If you want to search for 'b' for a given 'a', that is SELECT b FROM foo WHERE a = ? then an index on (a, b) would be useful. sqlite would look in the index for 'a = ?', and on finding it, would also immediately find the corresponding value of 'b' without having to go back to the table, go to the corresponding row with the 'a' value just looked up in the index and retrieve the 'b' value. Richard Hipp provided a very nice explanation in an email message titled "Re: [sqlite] An explanation?" dated 4/26/07. Search for it in the email archives. By the way, listers -- is there a way to provide a URI to a specific message in the archives? if yes, how? Say, I want to write an article, and want to link to a particular email message, what is the right (dependable and long-term, preferably to the official archives and not to a mirror such as nabble) way of doing so? -- Puneet Kishor http://www.punkish.org/ Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/ Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users