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 1ohsdY-0000SZ-Rr for pgsql-general@arkaria.postgresql.org; Mon, 10 Oct 2022 13:16:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ohsdX-0000pu-CJ for pgsql-general@arkaria.postgresql.org; Mon, 10 Oct 2022 13:16:03 +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 1ohsdX-0000pa-2J for pgsql-general@lists.postgresql.org; Mon, 10 Oct 2022 13:16:03 +0000 Received: from bar-esg2.cablenet.com.cy ([109.110.244.74] helo=barracuda.cablenet.com.cy) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ohsdU-0005yI-ER for pgsql-general@lists.postgresql.org; Mon, 10 Oct 2022 13:16:02 +0000 X-ASG-Debug-ID: 1665407758-17c036175987fa0001-cI9M9q Received: from mail0.cablenet.com.cy (mail.cablenet.com.cy [213.140.208.238]) by barracuda.cablenet.com.cy with ESMTP id ixggjAqq1ClDXTGg (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Mon, 10 Oct 2022 16:15:58 +0300 (EEST) X-Barracuda-Envelope-From: kostas@methodosit.com.cy X-Barracuda-Effective-Source-IP: mail.cablenet.com.cy[213.140.208.238] X-Barracuda-Apparent-Source-IP: 213.140.208.238 Received: from localhost (localhost [127.0.0.1]) by mail0.cablenet.com.cy (Postfix) with ESMTP id 806A55BBBCB; Mon, 10 Oct 2022 16:15:58 +0300 (EEST) Received: from mail0.cablenet.com.cy ([127.0.0.1]) by localhost (mail0.cablenet.com.cy [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id fkFUp6BZ3fNx; Mon, 10 Oct 2022 16:15:57 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by mail0.cablenet.com.cy (Postfix) with ESMTP id C26BB5BBBBF; Mon, 10 Oct 2022 16:15:57 +0300 (EEST) X-Virus-Scanned: amavisd-new at mail0.cablenet.com.cy Received: from mail0.cablenet.com.cy ([127.0.0.1]) by localhost (mail0.cablenet.com.cy [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6SNGn8b6a_dO; Mon, 10 Oct 2022 16:15:57 +0300 (EEST) Received: from [192.168.98.4] (66.red-88-21-136.staticip.rima-tde.net [88.21.136.66]) by mail0.cablenet.com.cy (Postfix) with ESMTPSA id 049265BBBB6; Mon, 10 Oct 2022 16:15:56 +0300 (EEST) Message-ID: Date: Mon, 10 Oct 2022 16:15:56 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: Same query, same data different plan Content-Language: en-US X-ASG-Orig-Subj: Re: Same query, same data different plan To: Julien Rouhaud Cc: Daevor The Devoted , pgsql-general@lists.postgresql.org References: <20b3e283-3107-cd18-6e7f-90ed58e7ddf8@methodosit.com.cy> <8da58bc7-a01a-0168-3d49-062258ac82ec@methodosit.com.cy> <20221010131217.7kzur6b63cl2we7y@jrouhaud> From: Kostas Papadopoulos In-Reply-To: <20221010131217.7kzur6b63cl2we7y@jrouhaud> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Barracuda-Connect: mail.cablenet.com.cy[213.140.208.238] X-Barracuda-Start-Time: 1665407758 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://172.30.36.5:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cablenet.com.cy X-Barracuda-Scan-Msg-Size: 559 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.101322 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Thank you for responding. My question is not about the performance of a specific query. As I wrote, that is already solved. My question is "how can it be that the same query run in two exactly the same databases can have different plans." Kostas Papadopoulos On 10/10/2022 16:12, Julien Rouhaud wrote: > On Mon, Oct 10, 2022 at 04:05:42PM +0300, Kostas Papadopoulos wrote: >> Hi, >> >> Yes, I ran ANALYZE in both databases. > > Please look at https://wiki.postgresql.org/wiki/Slow_Query_Questions to provide > more information.