On Thu, 28 Jan 2016 19:18:06 -0500
"Keith Medcalf" <kmedcalf at dessus.com> wrote:

> 
> When you create a table thusly:
> 
> create table x (x primary key, y, z);
> 
> you are creating a rowid table with columns x, y, an z.  You are also saying 
> that you want x to be the primary key.  Therefore, you will get a table 
> called x containing (ROWID, X, Y, Z).  This is a btree where the index is the 
> rowid.  In order to implement you PRIMARY KEY, an index must be constructed 
> containing the column X and ROWID in the table where the value of X is found. 
>  This index will be called sqlite_autoindex_x_1 because it is the first index 
> created automatically on table x.

Close to what I was suspecting. Thanks for these points.

> You could achieve the same result as follows:
> 
> create table x (x, y, z);
> create unique index pk_x_x on x(x);
> 
> except that now you have given the index on x an explicit name and one does 
> not have to be manufactured for you.
> 

I checked these indexes gets created even if I manually define similar indexes. 
But I don't mind. After some experiments, this seems more related to ROWID, and 
you seem to confirm a relation, above.


-- 
Yannick Duch?ne

Reply via email to