[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pgsql-committers
Subject:    pgsql: In pg_dump, avoid doing per-table queries for RLS policies.
From:       Tom Lane <tgl () sss ! pgh ! pa ! us>
Date:       2021-08-31 19:04:28
Message-ID: E1mL93c-0004jD-Hg () gemulon ! postgresql ! org
[Download RAW message or body]

[Attachment #2 (text/plain)]

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
------
REL9_6_STABLE

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

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 79 +++++++++++++++++++++++------------------------
1 file changed, 38 insertions(+), 41 deletions(-)



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic