On 30/06/2011, at 11:09 PM, Black, Michael (IS) wrote: > I believe you may be right...can someone in-the-know confirm that the "create > index" below is redundant?
I don't have inside knowledge, but yes, it is redundant to create an index on a primary key column. As I understand it: The built in integer primary key column on each table if effectively its own index. The table is organised (ie effectively "indexed") by that column, so a separate index would be just a repeat of what's already in the table, so would be redundant. For any other column (or columns) that you specify as primary key or unique: SQLite makes an automatic index for each. > I'm the type that likes to be explicit but perhaps that's a bad idea here. > Do we end up with 2 indexes thereby slowing things down on inserts? If you also make your own index (where an auto-index has already been made or it's the table's integer primary key), it would waste space and insert time (unless SQLite somehow aliases the two, but I don't think it does). Tom Brodhurst-Hill BareFeetWare -- iPhone/iPad/iPod and Mac software development, specialising in databases develo...@barefeetware.com -- Comparison of SQLite GUI tools: http://www.barefeetware.com/sqlite/compare/?ml _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users