Meaning of <sequence>.log_cnt?

Started by Ed L.about 23 years ago5 messagesgeneral
Jump to latest
#1Ed L.
pgsql@bluepolka.net

For a sequence called xxx, what is the meaning of the column
xxx_seq.log_cnt?

Ed

#2Richard Huxton
dev@archonet.com
In reply to: Ed L. (#1)
Re: Meaning of <sequence>.log_cnt?

On Friday 04 Apr 2003 4:32 pm, Ed L. wrote:

For a sequence called xxx, what is the meaning of the column
xxx_seq.log_cnt?

IIRC sequence numbers are handed out in batches rather than one at a time, to
reduce contention between backends. I think this is the number of unused
sequence numbers in the batch.

--
Richard Huxton

#3Ed L.
pgsql@bluepolka.net
In reply to: Richard Huxton (#2)
Re: Meaning of <sequence>.log_cnt?

On Friday April 4 2003 9:12, Richard Huxton wrote:

IIRC sequence numbers are handed out in batches rather than one at a
time, to reduce contention between backends. I think this is the number
of unused sequence numbers in the batch.

If you were wanting to sync a sequence on 2 separate dbs, as in master-slave
replication, log_cnt would not be a column you would care about?

Ed

#4Richard Huxton
dev@archonet.com
In reply to: Ed L. (#3)
Re: Meaning of <sequence>.log_cnt? (WRT REPLICATION)

On Friday 04 Apr 2003 5:20 pm, Ed L. wrote:

On Friday April 4 2003 9:12, Richard Huxton wrote:

IIRC sequence numbers are handed out in batches rather than one at a
time, to reduce contention between backends. I think this is the number
of unused sequence numbers in the batch.

If you were wanting to sync a sequence on 2 separate dbs, as in
master-slave replication, log_cnt would not be a column you would care
about?

Sorry - not sure there, it might be an idea to contact one of the replication
projects and ask there. If the slave is read-only it's not an issue of
course, but if you want to failover to the slave then you'll need to do a
setval() based on the largest used sequence value. If it's only used in one
column that's simple. If it's used in several places, more fiddly.

--
Richard Huxton

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ed L. (#3)
Re: Meaning of <sequence>.log_cnt?

"Ed L." <pgsql@bluepolka.net> writes:

If you were wanting to sync a sequence on 2 separate dbs, as in master-slave
replication, log_cnt would not be a column you would care about?

I don't believe so. My recollection is that it's actually the number of
IDs available before we have to write another WAL log entry for the
sequence. So unless you're using a replication method that can get at
WAL entries, it's a non-issue.

regards, tom lane