Re: [GENERAL] Partitioned Data and Locking

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] Partitioned Data and Locking
Дата
Msg-id 6610.1495299158@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [GENERAL] Partitioned Data and Locking  (Ed Behn <ed.behn@rockwellcollins.com>)
Список pgsql-general
Ed Behn <ed.behn@rockwellcollins.com> writes:
> If I run EXPLAIN on the query, I get a result that shows that only the
> child tables whose CHECKs are consistent with the WHERE clause are
> searched. This is exactly what I expected.
> However, when I run the query, AccessShareLocks are obtained by the
> transaction for all child tables (and their indices).

> Am I misunderstanding something? I seems that these locks shouldn't exist
> if the query plan doesn't use most of the child tables.

Nope, they must exist, because the planner has to examine those tables
to discover that their constraints allow skipping them at execution.

> If this is a bug, perhaps it could be fixed in a future release.

This is not a bug.  You might argue that we could release a child table's
lock once we've proven that we need not scan that table, but that's
fraught with theoretical and practical difficulties.  As one example,
once we've released that lock, someone could change the child's
constraint, invalidating the proof.  (Indeed, since AccessShareLock is
such a weak lock, it would more or less require DDL on the child table
for there to be any conflict.)

            regards, tom lane


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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: [GENERAL] Window functions can't be used as LIMIT/FETCH FIRST alternative
Следующее
От: Micky Hulse
Дата:
Сообщение: Re: [GENERAL] type "xxxxxxx" does not exist