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 1ohsl5-0000wo-MG for pgsql-general@arkaria.postgresql.org; Mon, 10 Oct 2022 13:23:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ohsl4-0006h4-3y for pgsql-general@arkaria.postgresql.org; Mon, 10 Oct 2022 13:23:50 +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 1ohsl3-0006gv-Q8 for pgsql-general@lists.postgresql.org; Mon, 10 Oct 2022 13:23:49 +0000 Received: from bar-esg1.cablenet.com.cy ([109.110.244.73] 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 1ohsl1-000635-7I for pgsql-general@lists.postgresql.org; Mon, 10 Oct 2022 13:23:49 +0000 X-ASG-Debug-ID: 1665408225-17c03518e48af80001-cI9M9q Received: from mail0.cablenet.com.cy (mail.cablenet.com.cy [213.140.208.238]) by barracuda.cablenet.com.cy with ESMTP id 2IzeyazwE5f7th8O (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Mon, 10 Oct 2022 16:23:45 +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 59ACB5BBBDD; Mon, 10 Oct 2022 16:23:45 +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 yHI5eYyvzvo2; Mon, 10 Oct 2022 16:23:45 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by mail0.cablenet.com.cy (Postfix) with ESMTP id DDD755BBBF5; Mon, 10 Oct 2022 16:23:44 +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 sPieqjeoUoYe; Mon, 10 Oct 2022 16:23:44 +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 43CCD5BBBDD; Mon, 10 Oct 2022 16:23:44 +0300 (EEST) Message-ID: Date: Mon, 10 Oct 2022 16:23:43 +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: Pavel Stehule Cc: Daevor The Devoted , pgsql-general@lists.postgresql.org, Julien Rouhaud 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: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Barracuda-Connect: mail.cablenet.com.cy[213.140.208.238] X-Barracuda-Start-Time: 1665408225 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://172.30.36.4:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cablenet.com.cy X-Barracuda-Scan-Msg-Size: 686 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests=BSF_SC0_SA983 X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.101322 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_SC0_SA983 Custom Rule BSF_SC0_SA983 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, I cannot see how it can be configuration since the two databases are in t= he same=20 Postgres instance. Kostas Papadopoulos On 10/10/2022 16:16, Pavel Stehule wrote: > po 10. 10. 2022 v 15:12 odes=C3=ADlatel Julien Rouhaud > napsal: >=20 >> On Mon, Oct 10, 2022 at 04:05:42PM +0300, Kostas Papadopoulos wrote: >>> Hi, >>> >>> Yes, I ran ANALYZE in both databases. >> >=20 > This can be a common case. Check your configuration: work_mem, > shared_buffers, effective_cache_size, random_page_cost, seq_page_cost, = ... >=20 >=20 >> Please look at https://wiki.postgresql.org/wiki/Slow_Query_Questions t= o >> provide >> more information. >> >> >> >=20