Re: Optimising Foreign Key checks

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: Optimising Foreign Key checks
Дата
Msg-id 51ACE34D.20409@nasby.net
обсуждение исходный текст
Ответ на Re: Optimising Foreign Key checks  (Simon Riggs <simon@2ndQuadrant.com>)
Ответы Re: Optimising Foreign Key checks  (Simon Riggs <simon@2ndQuadrant.com>)
Список pgsql-hackers
On 6/2/13 4:45 AM, Simon Riggs wrote:
>> >Will this add too much cost where it doesn't help?  I don't know what to
>> >predict there.  There's the obvious case of trivial transactions with no more
>> >than one referential integrity check per FK, but there's also the case of a
>> >transaction with many FK checks all searching different keys.  If the hash hit
>> >rate (key duplication rate) is low, the hash can consume considerably more
>> >memory than the trigger queue without preventing many RI queries.  What sort
>> >of heuristic could we use to avoid pessimizing such cases?
> I've struggled with that for a while now. Probably all we can say is
> that there might be one, and if there is not, then manual decoration
> of the transaction will be the way to go.

Just an idea... each backend could keep a store that indicates what FKs this would help with. For example, any time we
hita transaction that exercises the same FK more than once, we stick the OID of the FK constraint (or maybe of the two
tables)into a hash that's in that backend's top memory context. (Or if we want to be real fancy, shared mem).
 
-- 
Jim C. Nasby, Data Architect                       jim@nasby.net
512.569.9461 (cell)                         http://jim.nasby.net



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

Предыдущее
От: Kevin Grittner
Дата:
Сообщение: Re: Implicit rule created for materialized views
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: UTF-8 encoding problem w/ libpq