From: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: unlogged tables vs. GIST |
Date: | 2013-01-15 18:44:37 |
Message-ID: | 50F5A395.2070205@vmware.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 15.01.2013 20:33, Robert Haas wrote:
> On Tue, Jan 15, 2013 at 1:10 PM, Heikki Linnakangas
>> Could we stash the counter e.g. in the root page of the index?
>
> That would require maintaining a counter per table rather than a
> single global counter, which would be bad because then we'd need to
> store one counter in shared memory for every table, rather than just
> one, period, which runs up against the fixed sizing of shared memory.
I was thinking of just adding a new field to the root page header, and
use that field as the counter. Something like:
XLogRecPtr
GetXLogRecPtrForTemp(void)
{
rootbuf = ReadBuffer(rel, GIST_ROOT_BLKNO);
opaq = GistPageGetOpaque(BufferGetPage(rootbuf));
LockBuffer(rootbuf, GIST_EXCLUSIVE);
nsn = opaq->counter++
UnlockReleaseBuffer(rootbuf)
return nsn;
}
or perhaps we need to use locking mechanism for that, like just a new
global lwlock or spinlock, to avoid deadlocks if someone is just
splitting the root page. In any case, the fixed-sizedness of shared
memory isn't an issue here.
- Heikki
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-01-15 18:48:09 | Re: unlogged tables vs. GIST |
Previous Message | Robert Haas | 2013-01-15 18:33:17 | Re: unlogged tables vs. GIST |