Re: unlogged tables vs. GIST

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: unlogged tables vs. GIST
Дата
Msg-id 50F5A395.2070205@vmware.com
обсуждение исходный текст
Ответ на Re: unlogged tables vs. GIST  (Robert Haas <robertmhaas@gmail.com>)
Список 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: unlogged tables vs. GIST
Следующее
От: Tom Lane
Дата:
Сообщение: Re: unlogged tables vs. GIST