Re: init_sequence spill to hash table

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: init_sequence spill to hash table
Дата
Msg-id 20131114143339.GA7522@alap2.anarazel.de
обсуждение исходный текст
Ответ на Re: init_sequence spill to hash table  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: init_sequence spill to hash table  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2013-11-14 09:23:20 -0500, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > I think it'd be a better idea to integrate the sequence caching logic
> > into the relcache. There's a comment about it:
> >  * (We can't
> >  * rely on the relcache, since it's only, well, a cache, and may decide to
> >  * discard entries.)
> > but that's not really accurate anymore. We have the infrastructure for
> > keeping values across resets and we don't discard entries.
> 
> We most certainly *do* discard entries, if they're not open when a cache
> flush event comes along.

What I was aiming at is that we don't discard them because of a limited
cache size. I don't think it means much that we flush the entry when
it's changed but not referenced.

> I suppose it'd be possible to mark a relcache entry for a sequence
> as locked-in-core, but that doesn't attract me at all.  A relcache
> entry is a whole lot larger than the amount of state we really need
> to keep for a sequence.

But effectively that's what already happens unless either somebody else
does an ALTER SEQUENCE or sinval overflow happened, right? So in
production workloads we already will keep both around since hopefully
neither altering a sequence nor sinval overflows should be a frequent
thing.

> One idea is to have a hashtable for the sequence-specific data,
> but to add a link field to the relcache entry that points to the
> non-flushable sequence hashtable entry.  That would save the second
> hashtable lookup as long as the relcache entry hadn't been flushed
> since last use, while not requiring any violence to the lifespan
> semantics of relcache entries.  (Actually, if we did that, it might
> not even be worth converting the list to a hashtable?  Searches would
> become a lot less frequent.)

That's not a bad idea if we decide not to integrate them. And I agree,
there's not much need to have a separate hashtable in that case.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: init_sequence spill to hash table
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Clang 3.3 Analyzer Results