From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: In pg_dump, avoid doing per-table queries for RLS policies.
Date: Tue, 31 Aug 2021 19:04:28 +0000
Message-ID: <E1mL93c-0004j1-Fz@gemulon.postgresql.org> (raw)
In pg_dump, avoid doing per-table queries for RLS policies.
For no particularly good reason, getPolicies() queried pg_policy
separately for each table. We can collect all the policies in
a single query instead, and attach them to the correct TableInfo
objects using findTableByOid() lookups. On the regression
database, this reduces the number of queries substantially, and
provides a visible savings even when running against a local
server.
Per complaint from Hubert Depesz Lubaczewski. Since this is such
a simple fix and can have a visible performance benefit, back-patch
to all supported branches.
Discussion: https://postgr.es/m/20210826084430.GA26282@depesz.com
Branch
------
REL_13_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/db11b4a3db5f6613c844c1b3a6c203bbceb05532
Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 92 ++++++++++++++++++++++-------------------------
1 file changed, 42 insertions(+), 50 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: In pg_dump, avoid doing per-table queries for RLS policies.
In-Reply-To: <E1mL93c-0004j1-Fz@gemulon.postgresql.org>
References: <E1mL93c-0004j1-Fz@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox