Re: [sqlite] Use of AUTOINCREMENT

2014-03-28 Thread Simon Slavin
On 28 Mar 2014, at 2:09pm, Richard Hipp wrote: > The current "burn rate" on the SQLite repository is about 3650 record IDs > per year. Let's assume 10x the burn rate. Even then, it is another 58,000 > years or so before the 32-bit signed integer overflows. At that burn rate

Re: [sqlite] Use of AUTOINCREMENT

2014-03-28 Thread Eduardo Morras
On Fri, 28 Mar 2014 12:56:59 +0100 "Kleiner Werner" wrote: > > > Hello > I saw some discussions here about using the word "AUTOINCREMENT" for > a primary key or not. > Sometimes the meaning is "INTEGER PRIMARY KEY" is enough, because > this will also make an auto increment

Re: [sqlite] Use of AUTOINCREMENT

2014-03-28 Thread Stephan Beal
On Fri, Mar 28, 2014 at 1:50 PM, Simon Slavin wrote: > But this is not a documented specification for SQLite. It is allowed to > use any integer which is currently unused. I have no idea whether it's > allowed to use negative integers. > This is not a definitive answer

Re: [sqlite] Use of AUTOINCREMENT

2014-03-28 Thread Stephan Beal
On Fri, Mar 28, 2014 at 2:24 PM, Richard Hipp wrote: > SQLite prefers small positive rowids, since such rowids take up less space > on disk using the variable-length integer encoding. ( > http://www.sqlite.org/fileformat2.html#varint). But there are no > guarantees. > i guess

Re: [sqlite] Use of AUTOINCREMENT

2014-03-28 Thread Richard Hipp
On Fri, Mar 28, 2014 at 9:56 AM, Stephan Beal wrote: > On Fri, Mar 28, 2014 at 2:24 PM, Richard Hipp wrote: > > > SQLite prefers small positive rowids, since such rowids take up less > space > > on disk using the variable-length integer encoding. ( > >

Re: [sqlite] Use of AUTOINCREMENT

2014-03-28 Thread Igor Tandetnik
On 3/28/2014 7:56 AM, Kleiner Werner wrote: Does this mean, if there are 10 rows with id 1 -10 and I delete row with id 5, then the next insert will be ID = 5? Or is next ID = 11? Here's a more interesting example: you have ten rows with ids 1-10. You delete the row with id of 10 (the last

Re: [sqlite] Use of AUTOINCREMENT

2014-03-28 Thread Richard Hipp
On Fri, Mar 28, 2014 at 8:52 AM, Stephan Beal wrote: > On Fri, Mar 28, 2014 at 1:50 PM, Simon Slavin > wrote: > > > But this is not a documented specification for SQLite. It is allowed to > > use any integer which is currently unused. I have no

Re: [sqlite] Use of AUTOINCREMENT

2014-03-28 Thread Clemens Ladisch
Stephan Beal wrote: > On Fri, Mar 28, 2014 at 1:50 PM, Simon Slavin wrote: >> But this is not a documented specification for SQLite. It is allowed to >> use any integer which is currently unused. I have no idea whether it's >> allowed to use negative integers. > > This is

Re: [sqlite] Use of AUTOINCREMENT

2014-03-28 Thread Stephan Beal
On Fri, Mar 28, 2014 at 2:17 PM, Clemens Ladisch wrote: > sqlite> select * from u; > -100 > 1 > Very interesting, thank you :). That's quite subtle. -- - stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal "Freedom is sloppy. But since

Re: [sqlite] Use of AUTOINCREMENT

2014-03-28 Thread Simon Slavin
On 28 Mar 2014, at 12:23pm, Kees Nuyt wrote: > The next ID will usually be 11, but it is not guaranteed. > One day, it could suddenly be 5. Just to add more to that, the rule is currently along the lines of "New IDs will continue to increment until SQLite runs out of

Re: [sqlite] Use of AUTOINCREMENT

2014-03-28 Thread Kees Nuyt
On Fri, 28 Mar 2014 12:56:59 +0100, "Kleiner Werner" wrote: > > >Hello >I saw some discussions here about using the word "AUTOINCREMENT" for a primary >key or not. >  >Sometimes the meaning is "INTEGER PRIMARY KEY" is enough, because this will >also make an auto increment

[sqlite] Use of AUTOINCREMENT

2014-03-28 Thread Kleiner Werner
Hello I saw some discussions here about using the word "AUTOINCREMENT" for a primary key or not.   Sometimes the meaning is "INTEGER PRIMARY KEY" is enough, because this will also make an auto increment id.   Can someone give me a clarification if "AUTOINCREMENT" is needed or not? In the FAQ I