Re: sequence caches - Mailing list pgsql-general

From jks@selectacast.net
Subject Re: sequence caches
Date
Msg-id Pine.LNX.4.44.0305201311330.11027-100000@p1.selectacast.net
Whole thread Raw
In response to Re: sequence caches  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: sequence caches  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Tue, 20 May 2003, Tom Lane wrote:

> Joseph Shraibman <jks@selectacast.net> writes:
> > The way I understand it is a sequence cache works by getting more than one sequence id
> > from the sequence at once, which saves shared memory locking.  My question:  If I make a
> > query like:
> > SELECT NEXTVAL('seqname'),NEXTVAL('seqname'),NEXTVAL('seqname');
> > ... will that lock shared memory 3 times or just once?
>
> 3 times, unless you changed the default cache setting.
>
Is there a way to change the cache setting on a per-query basis?  For that
matter how can the cache setting be changed at all?  There is no ALTER
SEQUENCE command.

How hard would it be to change the backend to lock shared memory only once
per query?


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg newbie stumped on sequences!
Next
From: "Chris Palmer"
Date:
Subject: Re: PRIMARY KEYS