"Brian Johnson" <[EMAIL PROTECTED]> wrote:
> I have a few questions about autoincrement and RowID that I couldn't google an
> answer
> 
> I have a database for hardware with limited ram (and flash ram) so I'd like to
> use as little ram as possible.
> 
> Is there any difference between the hidden field rowid and a field defined as
> INTEGER PRIMARY KEY?
> 
> Is it possible to turn off or rename the rowid field?  .. I'll answer my own
> question here in case someone else googles for this .. according to
> http://www.sqlite.org/autoinc.html an INTEGER PRIMARY KEY becomes an alias to
> the rowid field and my tests confirm it .. so yes you can rename it this way.
> Maybe someone can confirm that the data is not taking up twice the RAM as one
> field?

Confirmed.

> 
> Why does a INTEGER PRIMARY KEY field autoincrement when inserting a NULL into
> that field as per http://www.sqlite.org/faq.html#q1 and a field defined as int
> primary key not work the same way?
> 

Because you might really want to insert a NULL into some
other INTEGER field.  But inserting a NULL into an INTEGER PRIMARY KEY
makes not sense.  Also, we can find the largest existing
INTEGER PRIMARY KEY in logorithmic time - or constant time
if the caching mechanism works.  Finding the largest
value of an regular INTEGER column is linear time and
is thus *much* slower.

--
D. Richard Hipp   <[EMAIL PROTECTED]>

Reply via email to