"Slater, Chad" <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> Consider the following lookup table definition:
> 
> CREATE TABLE foobar (
>     id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
>     table1_id INTEGER NOT NULL REFERENCES table1,
>     table2_id INTEGER NOT NULL REFERENCES table2
> );
> 
> The id primary key column is not necessary for anything in my
> application. But I've heard that some database implementations recommend
> the primary key for performance reasons. Is this true for sqlite?
> 
> 

No.

In fact, AUTOINCREMENT will slow things down since with
AUTOINCREMENT, the table has to keep track of the largest
primary key that has ever existed in the table in order to
insure that no key is ever repeated over the entire life
of the table.  AUTOINCREMENT in SQLite does not work like
MySQL.

Saying NOT NULL on a PRIMARY KEY is redundant, by the way.
--
D. Richard Hipp   <[EMAIL PROTECTED]>


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to