On 26 May 2017, at 2:47am, James K. Lowden <jklow...@schemamania.org> wrote:

> Nothing about any SQL statement implies anything about the
> implementation.  Thus, as you know, a unique constraint is not an
> instruction to build an index, much less a requirement to build a
> redundant one. It's a rule. Carry it out as ye may. 

The other side of this is that the SQL engine can make up indexes if it wants 
to.  And it can delete those indexes (though not indexes you asked for) if it 
wants to.  Automatic indexes are a detail of how the SQL engine does its job 
and not the programmer's responsibility.

So yes, OP spotted an unnecessary index in the cited case.  Whether it’s worth 
spotting the combination of things that lead to it is not settled.  Checking 
for the redundancy of "PRIMARY KEY UNIQUE" may slow down every CREATE TABLE 
command whereas this redundent index is created only when the programmer asks 
for it.  It may not be worth changing the way SQLite works now.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to