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 1i1S5h-00069x-LK
for pgsql-general@arkaria.postgresql.org; Sat, 24 Aug 2019 09:12:09 +0000
Received: from localhost ([127.0.0.1] helo=malur.postgresql.org)
by malur.postgresql.org with esmtp (Exim 4.89)
(envelope-from )
id 1i1S5g-0001lf-Dk
for pgsql-general@arkaria.postgresql.org; Sat, 24 Aug 2019 09:12:08 +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 1i1S5g-0001gz-1q
for pgsql-general@lists.postgresql.org; Sat, 24 Aug 2019 09:12:08 +0000
Received: from n3.nabble.com ([162.255.23.22])
by magus.postgresql.org with esmtp (Exim 4.89)
(envelope-from )
id 1i1S5c-0005FM-S7
for pgsql-general@postgresql.org; Sat, 24 Aug 2019 09:12:07 +0000
Received: from n3.nabble.com (localhost [127.0.0.1])
by n3.nabble.com (Postfix) with ESMTP id EAA921696A9A0
for ; Sat, 24 Aug 2019 02:12:02 -0700 (MST)
Date: Sat, 24 Aug 2019 02:12:02 -0700 (MST)
From: PegoraroF10
To: pgsql-general@postgresql.org
Message-ID: <1566637922958-0.post@n3.nabble.com>
In-Reply-To:
References:
<1565896167022-0.post@n3.nabble.com>
<88609b1c-1653-6d4c-c1b4-883e109f5b93@aklaver.com>
<1565963536657-0.post@n3.nabble.com> <19659.1565966519@sss.pgh.pa.us>
<1565968275886-0.post@n3.nabble.com> <1566596875387-0.post@n3.nabble.com>
<0eca5ab6-82cf-9768-6f09-0cb9998a1fdf@aklaver.com>
<1566599473175-0.post@n3.nabble.com>
Subject: Re: slow queries on system tables
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_41841_1992897975.1566637922958"
List-Id:
List-Help:
List-Subscribe:
List-Post:
List-Owner:
List-Archive:
Precedence: bulk
------=_Part_41841_1992897975.1566637922958
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
these values were collected before vacuum analyse:select (select reltuples
from pg_Class where relName = t.relName), * from pg_stat_sys_tables t where
schemaname = 'pg_catalog' and relname in
('pg_class','pg_attribute','pg_index');
reltuples relid schemaname relname seq_scan seq_tup_read idx_scan
idx_tup_fetch n_tup_ins n_tup_upd n_tup_del n_tup_hot_upd n_live_tup
n_dead_tup n_mod_since_analyze last_vacuum last_autovacuum last_analyze
last_autoanalyze vacuum_count autovacuum_count analyze_count
autoanalyze_count
930475 1249 pg_catalog pg_attribute 22462 61582178 646833988 2785143399
25381 776 15287 566 10094 15497 41444 NULL NULL NULL NULL 0 0 0 0
169186 1259 pg_catalog pg_class 5541140 39631813757 638041068 2316793709
2243 75187 625 44008 169891 5645 7435 NULL 2019-08-22 19:58:48.497317 NULL
2019-08-22 13:03:02.770579 0 415 0 1
87387 2610 pg_catalog pg_index 5263825 33638625440 246528384 590160274 1142
0 208 0 934 208 1350 NULL NULL NULL NULL 0 0 0 0
Then ... vacuum analyze pg_catalog.pg_index;vacuum analyze
pg_catalog.pg_attribute;vacuum analyze pg_catalog.pg_class;
reltuples relid schemaname relname seq_scan seq_tup_read idx_scan
idx_tup_fetch n_tup_ins n_tup_upd n_tup_del n_tup_hot_upd n_live_tup
n_dead_tup n_mod_since_analyze last_vacuum last_autovacuum last_analyze
last_autoanalyze vacuum_count autovacuum_count analyze_count
autoanalyze_count
940569 1249 pg_catalog pg_attribute 22550 61582570 646919000 2785430403
25381 776 15287 566 940569 0 0 2019-08-24 09:01:26.334472 NULL 2019-08-24
09:01:27.169883 NULL 1 0 1 0
150903 1259 pg_catalog pg_class 5542002 39640547448 638133339 2316941739
2243 75187 625 44008 150903 0 0 2019-08-24 09:01:33.130845 2019-08-22
19:58:48.497317 2019-08-24 09:01:33.441355 2019-08-22 13:03:02.770579 1 415
1 1
88321 2610 pg_catalog pg_index 5263994 33639781274 246576056 590229532 1142
0 208 0 88321 0 0 2019-08-24 09:01:18.080615 NULL 2019-08-24 09:01:18.275907
NULL 1 0 1 0
and this is explain before
https://explain.depesz.com/s/fUNB
and after
https://explain.depesz.com/s/1FZR
--
Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
------=_Part_41841_1992897975.1566637922958
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
these values were collected before vacuum analyse:
select (select reltuples from pg_Class where relName = t.relName), * from pg_stat_sys_tables t where schemaname = 'pg_catalog' and relname in ('pg_class','pg_attribute','pg_index');
| reltuples | relid | schemaname | relname | seq_scan | seq_tup_read | idx_scan | idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze | last_vacuum | last_autovacuum | last_analyze | last_autoanalyze | vacuum_count | autovacuum_count | analyze_count | autoanalyze_count |
| 930475 | 1249 | pg_catalog | pg_attribute | 22462 | 61582178 | 646833988 | 2785143399 | 25381 | 776 | 15287 | 566 | 10094 | 15497 | 41444 | NULL | NULL | NULL | NULL | 0 | 0 | 0 | 0 |
| 169186 | 1259 | pg_catalog | pg_class | 5541140 | 39631813757 | 638041068 | 2316793709 | 2243 | 75187 | 625 | 44008 | 169891 | 5645 | 7435 | NULL | 2019-08-22 19:58:48.497317 | NULL | 2019-08-22 13:03:02.770579 | 0 | 415 | 0 | 1 |
| 87387 | 2610 | pg_catalog | pg_index | 5263825 | 33638625440 | 246528384 | 590160274 | 1142 | 0 | 208 | 0 | 934 | 208 | 1350 | NULL | NULL | NULL | NULL | 0 | 0 | 0 | 0 |
Then ...
vacuum analyze pg_catalog.pg_index;
vacuum analyze pg_catalog.pg_attribute;
vacuum analyze pg_catalog.pg_class;
| reltuples | relid | schemaname | relname | seq_scan | seq_tup_read | idx_scan | idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze | last_vacuum | last_autovacuum | last_analyze | last_autoanalyze | vacuum_count | autovacuum_count | analyze_count | autoanalyze_count |
| 940569 | 1249 | pg_catalog | pg_attribute | 22550 | 61582570 | 646919000 | 2785430403 | 25381 | 776 | 15287 | 566 | 940569 | 0 | 0 | 2019-08-24 09:01:26.334472 | NULL | 2019-08-24 09:01:27.169883 | NULL | 1 | 0 | 1 | 0 |
| 150903 | 1259 | pg_catalog | pg_class | 5542002 | 39640547448 | 638133339 | 2316941739 | 2243 | 75187 | 625 | 44008 | 150903 | 0 | 0 | 2019-08-24 09:01:33.130845 | 2019-08-22 19:58:48.497317 | 2019-08-24 09:01:33.441355 | 2019-08-22 13:03:02.770579 | 1 | 415 | 1 | 1 |
| 88321 | 2610 | pg_catalog | pg_index | 5263994 | 33639781274 | 246576056 | 590229532 | 1142 | 0 | 208 | 0 | 88321 | 0 | 0 | 2019-08-24 09:01:18.080615 | NULL | 2019-08-24 09:01:18.275907 | NULL | 1 | 0 | 1 | 0 |
and this is explain before
https://explain.depesz.com/s/fUNB
and after
https://explain.depesz.com/s/1FZR
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
------=_Part_41841_1992897975.1566637922958--