Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sihul-008H0N-8m for pgsql-general@arkaria.postgresql.org; Mon, 26 Aug 2024 22:10:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sihuh-00FpCB-Jy for pgsql-general@arkaria.postgresql.org; Mon, 26 Aug 2024 22:10:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sihug-00Fp83-4y for pgsql-general@lists.postgresql.org; Mon, 26 Aug 2024 22:10:15 +0000 Received: from fhigh7-smtp.messagingengine.com ([103.168.172.158]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sihuc-001aEv-6c for pgsql-general@lists.postgresql.org; Mon, 26 Aug 2024 22:10:13 +0000 Received: from phl-compute-02.internal (phl-compute-02.nyi.internal [10.202.2.42]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 724831151C52; Mon, 26 Aug 2024 18:10:08 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Mon, 26 Aug 2024 18:10:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1724710208; x=1724796608; bh=IcT6+uyf9HP3x6JDOJC3sHHTKKXzMhxLGWG89aFiSKo=; b= YnQKpKcex84L/fc3baSqu5BkrQ8kiYumOPwxjP+OaftA70VewfraljFAN4EnzzA6 fdrnOOtOdaq7ikLzYq+annWwGE0fbUeNy7eZfjtRr6YuSpF8JjW2a2J8tj99+9L+ zyoqgYQHibZWxRLYpHmCzVB6Y1/nBP8/CJ7nZn4aKQmxv+dOkoHYfo4PYA80N5LW uXFO24M1RXSuTLNxTEh33VDNoRdw8CCR2s5yOK5Q7ZRD2C2g8cF8eJLV2LswWTCa 5CEWYS8GnRwBY9Fj+WUY9AYp/3qSViJ6DiSGa+h3/DXTi7KeeHPO5g1myEuyA6VQ YnKUU8csnqcTVF+Xks0D7g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1724710208; x= 1724796608; bh=IcT6+uyf9HP3x6JDOJC3sHHTKKXzMhxLGWG89aFiSKo=; b=j XFk6FEqh4sNKw6fuvJTEv6RaWvkf0tvSDgF9VLxBlEmaHWjo397m6aRiJFhWjaQu PzAlJ1Kvc8ES/NK1I95Ji1vSeCUtiuAV1JEoIR/SR44iqtW2YYYLs+4LsERG9yim Gc+X/QdAyH6pURI1WqQUDebg8/0VxU+3DJkGGLuKMrwEvJ6Hm5U9vPunR9oQNV17 10somfVEE0VJOBqxK5LmVWnxA+PTOV18ocfsFL/mh3OlQAIuA/TpvyrY4wpelARK KUpl7ps1qqucwrrdtkgQKC5VA28D4/H3aGjrADeUAczecENqIhM9JGS15rcClkI0 SrVEbx87cQRPlJzw99OjA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddvledgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdej necuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrh esrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepudeugeefueejudelvefg jefgfeekiefgueehfeffkeefhfetieekudeujeejvdeinecuffhomhgrihhnpegurghlih gsohdrtghomhdpuggvphgvshiirdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrh drtghomhdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthht ohepnhhikhhhihhlrhgrjhegjeegsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgsh hqlhdqghgvnhgvrhgrlheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhgpdhrtghp thhtohepphgrthgvlhhnihhkihhtrgdugeduudesghhmrghilhdrtghomhdprhgtphhtth hopehprghtvghlkhhhuhhshhgsuhdvtdeijeesghhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 26 Aug 2024 18:10:07 -0400 (EDT) Message-ID: <7e0e289f-c92d-40cc-bf46-162d484a5df4@aklaver.com> Date: Mon, 26 Aug 2024 15:10:06 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Significant Execution Time Difference Between PG13.14 and PG16.4 for Query on information_schema Tables. To: nikhil raj , "pgsql-generallists.postgresql.org" Cc: NIKITA PATEL , Patel Khushbu References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/26/24 14:49, nikhil raj wrote: > Hi All, > > I've encountered a noticeable difference in execution time and query > execution plan row counts between PostgreSQL 13 and PostgreSQL 16 when > running a query on |information_schema| tables. Surprisingly, PostgreSQL > 16 is performing slower than PostgreSQL 13. Did you run ANALYZE on the Postgres 16 instance? > *4PostgreSQL 13.14 (PostgreSQL 13.14 on x86_64-pc-linux-gnu, compiled by > gcc 11.4.0, 64-bit)* > Execution plan: PG13.14 Execution Plan > > > *PostgreSQL 16.4 (PostgreSQL 16.4 on x86_64-pc-linux-gnu, compiled by > gcc 11.4.0, 64-bit)* > Execution plan: PG16.4 Execution Plan > Use: https://explain.depesz.com/ It is easier to follow it's output. > > > Has anyone else experienced similar behavior or could provide insights > into why PostgreSQL 16 might be slower for this query? Any advice or > suggestions for optimization would be greatly appreciated. Yes when ANALYZE was not run on a new instance. > > Thank you! > > NOTE:-  PFA the raw file of explain and analyze below. > > > > -- Adrian Klaver adrian.klaver@aklaver.com