pgsql: Fix up run-time partition pruning's use of relcache'spartition

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix up run-time partition pruning's use of relcache'spartition
Дата
Msg-id E1fT8Fa-0005CN-UL@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix up run-time partition pruning's use of relcache's partition data.

The previous coding saved pointers into the partitioned table's relcache
entry, but then closed the relcache entry, causing those pointers to
nominally become dangling.  Actual trouble would be seen in the field
only if a relcache flush occurred mid-query, but that's hardly out of
the question.

While we could fix this by copying all the data in question at query
start, it seems better to just hold the relcache entry open for the
whole query.

While at it, improve the handling of support-function lookups: do that
once per query not once per pruning test.  There's still something to be
desired here, in that we fail to exploit the possibility of caching data
across queries in the fn_extra fields of the relcache's FmgrInfo structs,
which could happen if we just used those structs in-place rather than
copying them.  However, combining that with the possibility of per-query
lookups of cross-type comparison functions seems to require changes in the
APIs of a lot of the pruning support functions, so it's too invasive to
consider as part of this patch.  A win would ensue only for complex
partition key data types (e.g. arrays), so it may not be worth the
trouble.

David Rowley and Tom Lane

Discussion: https://postgr.es/m/17850.1528755844@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e23bae82cf3d76365d48b1204ca4c631bac7550d

Modified Files
--------------
src/backend/executor/execPartition.c | 63 ++++++++++++++++++++++++----------
src/backend/executor/nodeAppend.c    | 14 +++++---
src/backend/partitioning/partprune.c | 51 ++++++++++++++++++----------
src/backend/utils/cache/relcache.c   |  6 ++--
src/include/executor/execPartition.h |  5 +--
src/include/partitioning/partprune.h | 66 ++++++++++++++++++++----------------
6 files changed, 132 insertions(+), 73 deletions(-)


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

Предыдущее
От: Alexander Korotkov
Дата:
Сообщение: pgsql: Documentation improvement for pg_trgm
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix some ill-chosen names for globally-visible partitionsupport