pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
(no subject)
2+ messages / 2 participants
[nested] [flat]

* (no subject)
@ 2006-02-10 17:42  Jean-Christophe Roux <jcxxr@yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Jean-Christophe Roux @ 2006-02-10 17:42 UTC (permalink / raw)
  To: pgsql-general

Hello,
I have a table with and id field (primary key) which default value is the result of a sequence (increment explicitly set to 1). 
To my surprise, the real increment on insert is the total number of rows of the table. For instance, with 41 rows and a sequence last_value of 1141, the next insert row will have a value of 1182. It is not a big problem but I don't like skipping and wasting values in a sequence. Also, I'd like to understand what's going on!
If someone could give me a clue that wold be greatly appreciated 
thanks
JC


		
---------------------------------
 
 What are the most popular cars? Find out at Yahoo! Autos 

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re:
@ 2006-02-11 13:54  Pandurangan R S <pandurangan.r.s@gmail.com>
  parent: Jean-Christophe Roux <jcxxr@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Pandurangan R S @ 2006-02-11 13:54 UTC (permalink / raw)
  To: Jean-Christophe Roux <jcxxr@yahoo.com>; +Cc: pgsql-general

try using CACHE 1 (which is default) in the sequence defintion.

http://www.postgresql.org/docs/8.1/static/sql-createsequence.html

On 2/10/06, Jean-Christophe Roux <jcxxr@yahoo.com> wrote:
> Hello,
> I have a table with and id field (primary key) which default value is the
> result of a sequence (increment explicitly set to 1).
> To my surprise, the real increment on insert is the total number of rows of
> the table. For instance, with 41 rows and a sequence last_value of 1141, the
> next insert row will have a value of 1182. It is not a big problem but I
> don't like skipping and wasting values in a sequence. Also, I'd like to
> understand what's going on!
> If someone could give me a clue that wold be greatly appreciated
> thanks
> JC
>
>
>
>  ________________________________
>
>  What are the most popular cars? Find out at Yahoo! Autos
>
>



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-02-11 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-02-10 17:42  Jean-Christophe Roux <jcxxr@yahoo.com>
2006-02-11 13:54 ` Re: Pandurangan R S <pandurangan.r.s@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox