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 1ohuS6-0007iK-9Q for pgsql-general@arkaria.postgresql.org; Mon, 10 Oct 2022 15:12:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ohuS5-0002lk-1m for pgsql-general@arkaria.postgresql.org; Mon, 10 Oct 2022 15:12:21 +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 1ohuS4-0002kf-O0 for pgsql-general@lists.postgresql.org; Mon, 10 Oct 2022 15:12:20 +0000 Received: from bar-esg2.cablenet.com.cy ([109.110.244.74] helo=barracuda.cablenet.com.cy) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ohuS1-0005s6-5c for pgsql-general@lists.postgresql.org; Mon, 10 Oct 2022 15:12:19 +0000 X-ASG-Debug-ID: 1665414733-17c03617588c440001-cI9M9q Received: from mail0.cablenet.com.cy (mail.cablenet.com.cy [213.140.208.238]) by barracuda.cablenet.com.cy with ESMTP id KAHaUnd0VnkgIwaf (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Mon, 10 Oct 2022 18:12:13 +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 4C3985B0064; Mon, 10 Oct 2022 18:12:13 +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 tId1kO2AxNGa; Mon, 10 Oct 2022 18:12:12 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by mail0.cablenet.com.cy (Postfix) with ESMTP id E0FCD5AFD52; Mon, 10 Oct 2022 18:12:12 +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 EDk8CAx_DtME; Mon, 10 Oct 2022 18:12:12 +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 2989A5AFD05; Mon, 10 Oct 2022 18:12:12 +0300 (EEST) Message-ID: <37fcbc79-c9c9-979d-f7ad-43771e7923c5@methodosit.com.cy> Date: Mon, 10 Oct 2022 18:12:11 +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: Tom Lane Cc: Pavel Stehule , 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> <4073393.1665413623@sss.pgh.pa.us> From: Kostas Papadopoulos In-Reply-To: <4073393.1665413623@sss.pgh.pa.us> 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: 1665414733 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: 1072 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.101324 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/10/2022 17:53, Tom Lane wrote: > Kostas Papadopoulos writes: >> I cannot see how it can be configuration since the two databases are in the same >> Postgres instance. > > There is such a thing as ALTER DATABASE ... SET to install different > settings at the per-database level. I understand, but I created the databases to be the same. Our original problem was that developers' workstations (Debian and Windows) were running a specific query different from a test db (Ubuntu). After eliminating everything we thought of (data, versions, configurations, OS, etc) we ended up with the scenario I described here. > > In general, the answer to your question is that the databases are > *not* identical. You just haven't figured out how yet. I'm wondering > if it has something to do with the dump/reload having compacted out > bloat in the tables or indexes, causing cost estimates to change. I will look into that and a couple of other ideas I got from this list. > > regards, tom lane Thanks kostas