From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: In pg_dump, avoid doing per-table queries for RLS policies. |
Date: | 2021-08-31 19:04:28 |
Message-ID: | E1mL93c-0004ix-FD@gemulon.postgresql.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | John Naylor | 2021-08-31 19:21:31 | pgsql: Mark the timestamptz variant of date_bin() as stable |
Previous Message | Tom Lane | 2021-08-31 17:54:12 | pgsql: Cache the results of format_type() queries in pg_dump. |