Skip site navigation (1) Skip section navigation (2)

Re: Bug #613: Sequence values fall back to previously chec

From: "Tom Pfau" <T(dot)Pfau(at)emCrit(dot)com>
To: "Mikheev, Vadim" <vmikheev(at)SECTORBASE(dot)COM>,"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, <bgrimm(at)zaeon(dot)com>,<pgsql-bugs(at)postgresql(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug #613: Sequence values fall back to previously chec
Date: 2002-03-14 15:26:50
Message-ID: 5C47691674725C47B02996F02C0D362105F72A@exchange.rane.net (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
I don't fully understand the xlog files or WAL records but...

Why isn't the writing of the WAL record based on the CACHE value of the
sequence?  If a request to nextval() can't be satisfied by the cache,
the sequence on disk should be updated resulting in a WAL record being
written.

If two sessions are accessing the sequence, they will likely end up not
writing sequential values as they have both taken a chunk of values by
calling nextval() but the effect of this could be controlled by the user
by selecting an acceptable value for CACHE.  If I don't mind having
session 1 write records 1-10 while session 2 interleaves those with
records 11-20, I should set my cache to 10.  If I want my id's to map to
insertion time as closely as possible I should set the cache lower (or
NOCACHE, is that an option?).

I'm concerned that the discussion here has been of the opinion that
since no records were written to the database using the value retrieved
from the sequence that no damage has been done.  We are using database
sequences to get unique identifiers for things outside the database.  If
a sequence could ever under any circumstances reissue a value, this
could be damaging to the integrity of our software.

Responses

pgsql-hackers by date

Next:From: bgrimmDate: 2002-03-14 15:29:18
Subject: Re: Bug #613: Sequence values fall back to previously chec
Previous:From: Turbo FredrikssonDate: 2002-03-14 15:00:36
Subject: Re: 'Following' the Primary key

pgsql-bugs by date

Next:From: bgrimmDate: 2002-03-14 15:29:18
Subject: Re: Bug #613: Sequence values fall back to previously chec
Previous:From: Tom PfauDate: 2002-03-14 15:12:26
Subject: Re: comparing null value in plpgsql.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group