Re: Refresh Publication takes hours and doesn´t finish

Поиск
Список
Период
Сортировка
От PegoraroF10
Тема Re: Refresh Publication takes hours and doesn´t finish
Дата
Msg-id 1558383480253-0.post@n3.nabble.com
обсуждение исходный текст
Ответ на Refresh Publication takes hours and doesn´t finish  (PegoraroF10 <marcos@f10.com.br>)
Ответы Re: Refresh Publication takes hours and doesn´t finish  (Fabrízio de Royes Mello <fabrizio@timbira.com.br>)
Re: Re: Refresh Publication takes hours and doesn´t finish  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I tried sometime ago ... but with no responses, I ask you again.
pg_publication_tables is a view that is used to refresh publication, but as
we have 15.000 tables, it takes hours and doesn´t complete. If I change that
view I can have an immediate result. The question is: Can I change that view
? There is some trouble changing those system views ?

Original View is ...
create view pg_catalog.pg_publication_tables as
SELECT p.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 pg_get_publication_tables.relid FROM
pg_get_publication_tables((p.pubname)::text)
pg_get_publication_tables(relid)));
This way it takes 45 minutes to respond.

I changed it to ...
create or replace pg_catalog.view pg_publication_tables as SELECT p.pubname,
n.nspname AS schemaname, c.relname AS tablename from pg_publication p inner
join pg_get_publication_tables(p.pubname) pt on true inner join pg_class c
on pt.relid = c.oid inner join pg_namespace n ON (n.oid = c.relnamespace);
This one takes just one or two seconds.



--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html



В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: INSERT where not exists with foreign key
Следующее
От: Will Hartung
Дата:
Сообщение: Re: Loading table with indexed jsonb field is stalling