Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSojX-0003MO-Iv for pgsql-general@arkaria.postgresql.org; Mon, 20 May 2019 20:18:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hSojW-0007Ya-A3 for pgsql-general@arkaria.postgresql.org; Mon, 20 May 2019 20:18:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSojW-0007Y0-0j for pgsql-general@lists.postgresql.org; Mon, 20 May 2019 20:18:06 +0000 Received: from n3.nabble.com ([162.255.23.22]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hSojS-00005D-RT for pgsql-general@postgresql.org; Mon, 20 May 2019 20:18:05 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 47FEC142961FF for ; Mon, 20 May 2019 13:18:00 -0700 (MST) Date: Mon, 20 May 2019 13:18:00 -0700 (MST) From: PegoraroF10 To: pgsql-general@postgresql.org Message-ID: <1558383480253-0.post@n3.nabble.com> In-Reply-To: <1551385426763-0.post@n3.nabble.com> References: <1551385426763-0.post@n3.nabble.com> Subject: =?UTF-8?Q?Re:_Refresh_Publication_takes_hours_and_doesn=C2=B4t_finish?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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=C2=B4t complete. If I chang= e that view I can have an immediate result. The question is: Can I change that vie= w ? 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 =3D c.relnamespace)))=20 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 ...=20 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 =3D c.oid inner join pg_namespace n ON (n.oid =3D c.relnamespac= e); This one takes just one or two seconds. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.ht= ml