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 1oxsov-0008O5-KZ for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Nov 2022 16:41:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oxsou-0003sY-BX for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Nov 2022 16:41:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oxsou-0003sM-3q for pgsql-bugs@lists.postgresql.org; Wed, 23 Nov 2022 16:41:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oxsop-000075-IT for pgsql-bugs@lists.postgresql.org; Wed, 23 Nov 2022 16:41:55 +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 2ANGfmxb3715056; Wed, 23 Nov 2022 11:41:48 -0500 From: Tom Lane To: aless.jeant@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17693: Slow performance: Much slower queries on pg_stat_all_tables since 13.4 In-reply-to: <17693-8d263aff1ffe112f@postgresql.org> References: <17693-8d263aff1ffe112f@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Wed, 23 Nov 2022 14:46:47 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3715054.1669221708.1@sss.pgh.pa.us> Date: Wed, 23 Nov 2022 11:41:48 -0500 Message-ID: <3715055.1669221708@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > We did a point upgrade through RDS's managed service which went from 13.4 to > 13.7. (13.9 is unavailable and we have yet to upgrade to 13.8 - however I > couldn't find any documentation or issue history reporting similar symptoms > in the past year of discussions here) > This created a weird bug which is causing a lot of strain on our systems, > because we currently run a lot of queries over the pg_stat_all_tables, in > order to choose candidate tables most appropriate to vacuum preemptively in > a production system (we have a lot of active tables, order of magnitude 100k > tables) > Before this, queries would take <<1 second, now they're always ~5 seconds, > regardless of what we are filtering on. RDS is not Postgres; the underlying storage engine is completely different, as a consequence of which the Postgres layer is pretty heavily modified (or so we in the community assume, having never seen any of their source code). I think you need to take this up with Amazon. Just to check, I did create a database with 100K tables in community Postgres 13.9, and I didn't see any odd behavior with selecting from pg_stat_all_tables. regards, tom lane