Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltWwn-0002lt-RS for pgsql-general@arkaria.postgresql.org; Wed, 16 Jun 2021 14:55:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ltWwm-0005nQ-Q2 for pgsql-general@arkaria.postgresql.org; Wed, 16 Jun 2021 14:55:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltWwm-0005nG-H9 for pgsql-general@lists.postgresql.org; Wed, 16 Jun 2021 14:55:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltWwk-0000ni-Jz for pgsql-general@lists.postgresql.org; Wed, 16 Jun 2021 14:55:15 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 15GEtD0D648425; Wed, 16 Jun 2021 10:55:13 -0400 From: Tom Lane To: Marcin Barczynski cc: pgsql-general@lists.postgresql.org Subject: Re: Establishing a local connection to PostgreSQL 9.6 takes seconds In-reply-to: References: <646103.1623852611@sss.pgh.pa.us> Comments: In-reply-to Marcin Barczynski message dated "Wed, 16 Jun 2021 16:47:33 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <648423.1623855313.1@sss.pgh.pa.us> Date: Wed, 16 Jun 2021 10:55:13 -0400 Message-ID: <648424.1623855313@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Marcin Barczynski writes: > It turned out to be pg_attribute. It was bloated probably due to the large > number of temp tables created. > Are there any recommendations on how to prevent such a bloat from happening? You could perhaps apply more aggressive autovacuum settings to that catalog. That won't be enough to get rid of the existing problem; you'll likely need to do a VACUUM FULL on it to remove the bloat. But autovac ought to be able to keep up with things in future, if tuned right. My guess is that pg_class has also got a bloat problem, though perhaps not as severe. regards, tom lane