On 13 Sep 2011, at 1:07pm, François wrote: > Can we consider that creating an index for an integer field is a good > practice if this field has at least 3 possible values ? Or more ?
It's about chunkiness, and which of the values you're looking for. If all possible values are equally distributed, and you frequently look for a particular value, the index will help even if you have only two possible values. If you have almost all '2011' rows, and you're searching for '2011', then the index won't help much. One nice thing about SQL is the command syntax doesn't change when you make or delete indexes. So without having to chance your app you can write your code, get it working, then experiment with CREATE and DROPping indexes and see whether this improves speed. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users