All,
In the link mentioned it says: "If the largest ROWID is equal to the
largest possible integer (9223372036854775807 in SQLite version 3.0.0
and later) then the database engine starts picking candidate ROWIDs at
random until it finds one that is not previously used". I want to
understand the algorithm used by DB engine for picking candidate ROWID's
at random until it finds one that is not previously used. 
Also it's mentioned on website: If you ever delete rows or if you ever
create a row with the maximum possible ROWID, then ROWIDs from
previously deleted rows "might be" reused when creating new rows and
newly created ROWIDs might not be in strictly ascending order.
I would like to know why it says "might be" reused. So is it possible
that SQLITE will give an error when attempting to insert a record even
if there are free ROWID's?
Please consider this scenario in the worst case. I agree that the number
of ROWID's is so large, but still there is a possibility it might be
filled. I basically want to understand the algorithm used by SQLITE in
picking a new ROWID in such scenario.

Regards,
Phanisekhar



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jay A. Kreibich
Sent: Tuesday, March 11, 2008 12:02 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Generating new rowid algo

On Mon, Mar 10, 2008 at 11:35:23PM +0530, B V, Phanisekhar scratched on
the wall:
> All,
> 
>      I wanted to know the algorithm used by sqlite to generate the new
> rowid. Assume there can be N distinct rowid's possible, now insert N
> records, followed by random deletion of some records. Now what rowid
> will be assigned to a new row that is added?

  Depends on how the table is setup.  For more information:

  http://www.sqlite.org/autoinc.html



   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"'People who live in bamboo houses should not throw pandas.' Jesus said
that."
   - "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech
2006"
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to