pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
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-0004ix-FD@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
------
master

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

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 92 ++++++++++++++++++++++-------------------------
1 file changed, 42 insertions(+), 50 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1mL93c-0004ix-FD@gemulon.postgresql.org>
Permalink:  ../E1mL93c-0004ix-FD@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mL93c-0004ix-FD@gemulon.postgresql.org

 · 

reply

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-0004ix-FD@gemulon.postgresql.org>
  References: <E1mL93c-0004ix-FD@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