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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-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

Browse pgsql-bugs by date

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

Browse pgsql-hackers by date

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