> If I have a query:
> 
> SELECT foo FROM bar WHERE id = 14;
> 
> How can I see if that query is optimized to use an index, and which index
> it's using. I thought if you did an EXPLAIN it would show that, but I'm not
> seeing it? Maybe it's not really using an index?

Use the command "EXPLAIN QUERY PLAN {your sql command}".  This will give 
you a high level overview of all the tables being accessed, and which 
indices (if any) will be used for each.

For a simple query like your example, SQLite will almost certainly use 
an index on "id" if one is available.  You can use above to verify this.

~Eric
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to