Re: sequence caches

From: jks(at)selectacast(dot)net
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: sequence caches
Date: 2003-05-20 17:22:19
Message-ID: Pine.LNX.4.44.0305201311330.11027-100000@p1.selectacast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 20 May 2003, Tom Lane wrote:

> Joseph Shraibman <jks(at)selectacast(dot)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?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Palmer 2003-05-20 17:30:27 Re: PRIMARY KEYS
Previous Message Tom Lane 2003-05-20 17:19:06 Re: pg newbie stumped on sequences!