Обсуждение: Meaning of .log_cnt?

Поиск
Список
Период
Сортировка

Meaning of .log_cnt?

От
"Ed L."
Дата:
For a sequence called xxx, what is the meaning of the column
xxx_seq.log_cnt?

Ed


Re: Meaning of .log_cnt?

От
Richard Huxton
Дата:
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


Re: Meaning of .log_cnt?

От
"Ed L."
Дата:
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


Re: Meaning of .log_cnt? (WRT REPLICATION)

От
Richard Huxton
Дата:
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


Re: Meaning of .log_cnt?

От
Tom Lane
Дата:
"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