pgsql: Allow a partdesc-omitting-partitions to be cached

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow a partdesc-omitting-partitions to be cached
Date: 2021-04-28 19:48:08
Message-ID: E1lbqAK-0008Os-1z@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow a partdesc-omitting-partitions to be cached

Makes partition descriptor acquisition faster during the transient
period in which a partition is in the process of being detached.

This also adds the restriction that only one partition can be in
pending-detach state for a partitioned table.

While at it, return find_inheritance_children() API to what it was
before 71f4c8c6f74b, and create a separate
find_inheritance_children_extended() that returns detailed info about
detached partitions.

(This incidentally fixes a bug in 8aba9322511 whereby a memory context
holding a transient partdesc is reparented to a NULL PortalContext,
leading to permanent leak of that memory. The fix is to no longer rely
on reparenting contexts to PortalContext. Reported by Amit Langote.)

Per gripe from Amit Langote
Discussion: https://postgr.es/m/CA+HiwqFgpP1LxJZOBYGt9rpvTjXXkg5qG2+Xch2Z1Q7KrqZR1A@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml | 2 +
src/backend/catalog/pg_inherits.c | 52 +++++++++-
src/backend/commands/tablecmds.c | 66 ++++++++-----
src/backend/commands/trigger.c | 3 +-
src/backend/partitioning/partdesc.c | 101 +++++++++++++------
src/backend/utils/cache/relcache.c | 33 ++++++-
src/include/catalog/pg_inherits.h | 6 +-
src/include/utils/rel.h | 15 +++
.../expected/detach-partition-concurrently-3.out | 110 ++++++++++++++++++++-
.../specs/detach-partition-concurrently-3.spec | 14 ++-
10 files changed, 329 insertions(+), 73 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-04-28 19:50:57 pgsql: Add heuristic incoming-message-size limits in the server.
Previous Message Tom Lane 2021-04-28 14:03:49 pgsql: Doc: fix discussion of how to get real Julian Dates.