fix-pg_publication_tables-performance.patch
text/x-diff
Filename: fix-pg_publication_tables-performance.patch
Type: text/x-diff
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/catalog/system_views.sql | 4 | 3 |
| src/test/regress/expected/rules.out | 2 | 2 |
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
index 566100d..52a6c31 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -258,9 +258,10 @@ CREATE VIEW pg_publication_tables AS
P.pubname AS pubname,
N.nspname AS schemaname,
C.relname AS tablename
- FROM pg_publication P, pg_class C
- JOIN pg_namespace N ON (N.oid = C.relnamespace)
- WHERE C.oid IN (SELECT relid FROM pg_get_publication_tables(P.pubname));
+ FROM pg_publication P,
+ LATERAL pg_get_publication_tables(P.pubname) GPT,
+ pg_class C JOIN pg_namespace N ON (N.oid = C.relnamespace)
+ WHERE C.oid = GPT.relid;
CREATE VIEW pg_locks AS
SELECT * FROM pg_lock_status() AS L;
diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out
index 0c392e5..4363ca1 100644
--- a/src/test/regress/expected/rules.out
+++ b/src/test/regress/expected/rules.out
@@ -1441,10 +1441,10 @@ pg_publication_tables| SELECT p.pubname,
n.nspname AS schemaname,
c.relname AS tablename
FROM pg_publication p,
+ LATERAL pg_get_publication_tables((p.pubname)::text) gpt(relid),
(pg_class c
JOIN pg_namespace n ON ((n.oid = c.relnamespace)))
- WHERE (c.oid IN ( SELECT pg_get_publication_tables.relid
- FROM pg_get_publication_tables((p.pubname)::text) pg_get_publication_tables(relid)));
+ WHERE (c.oid = gpt.relid);
pg_replication_origin_status| SELECT pg_show_replication_origin_status.local_id,
pg_show_replication_origin_status.external_id,
pg_show_replication_origin_status.remote_lsn,