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 1oht4h-0002EA-Gf for pgsql-general@arkaria.postgresql.org; Mon, 10 Oct 2022 13:44:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oht4g-0003TG-78 for pgsql-general@arkaria.postgresql.org; Mon, 10 Oct 2022 13:44:06 +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 1oht4f-0003T7-RA for pgsql-general@lists.postgresql.org; Mon, 10 Oct 2022 13:44:05 +0000 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oht4d-00054K-ES for pgsql-general@lists.postgresql.org; Mon, 10 Oct 2022 13:44:04 +0000 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1322d768ba7so12505335fac.5 for ; Mon, 10 Oct 2022 06:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=dLy3S0oLuued+ptm3YP8Ki8oiUqUzbQwxOaUB5ZiagU=; b=j93QStgvrvV85z8I2MBtlCCY7rFSe6/PxxXanSKXtPk/9gbQnMg0J/s96SoLwSiwje yqi3+ZXGV6h66sAxqt9lAeyECmE1cW5iANUxTEFk1F+tg9EjkOAVqT6w72pSM8MkokY9 QVWuHkU7U0f2lMSxJSOWaWREutvq6JGT9Oapl+PZ74tiIOTWSSNzePc8hhcLXdKxdt49 o4sAFrepHxXgphE8ntm+mOlFWKovcyZ2LrvhIskFfF8yk8itmbnJhrA2rQpLsRHcdcGZ ovkTRNpt4hZl9c2Lq1kZ2AnJJ2PEvP0jdWpXE+JsyqLL+aEkcuTgfNwFL+PqW+z6UxQD 4N2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dLy3S0oLuued+ptm3YP8Ki8oiUqUzbQwxOaUB5ZiagU=; b=zUtLEZ3umB+1xi9kyFV7dU0Y58UVdckcsyTSNBKtFoSZAaHRz1BLi8xWWALSjhKY8K pjx9lJsla3iaO+roa92wrv2Ld+RJJKANpP+bjoPQK9JF3uOmIevfTLGbCR70FhjPO2CT 6LCWOe2R1I5F++IS+CDCj9llb0/NntV6xBzhRMaWfHAaCn55zbDMhFCfrQ6ZTsi6192i N5xZArsZ3Z65IepdkdtbUAi7CZT6DdxwTuiqyuMOS57oafcWtWT+VDCEcjlZWF1QkcNq noHCk1E6gTBr+6qeLYl68IA5Y7Gtr6oiIcTRLat+vIlzL4jEH2Vwg7oJLpASNRzwWEgR 6xYg== X-Gm-Message-State: ACrzQf0j7Wt6CFDQIx+izfxumI0rOZdbZE9rKQ8/QwMcmtq0+gFu4mN/ zlAGVEfRTio3ONgHIvA+fokIbwMAJT0= X-Google-Smtp-Source: AMsMyM5dfLTCZ9l2Gr4TnhCioni5R8beD8NYIzVI/+0IPhe8V+U/HhZZmdGhL2uSKp9fCjkFmhEUoQ== X-Received: by 2002:a05:6871:72a:b0:132:f0e0:e665 with SMTP id f42-20020a056871072a00b00132f0e0e665mr9490672oap.79.1665409442319; Mon, 10 Oct 2022 06:44:02 -0700 (PDT) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id i9-20020a4adf09000000b00476989d42ebsm4164405oou.8.2022.10.10.06.44.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Oct 2022 06:44:01 -0700 (PDT) Message-ID: <370be1df-d840-d08c-0cbb-27b4b33a0e1c@gmail.com> Date: Mon, 10 Oct 2022 08:44:00 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: Same query, same data different plan Content-Language: en-US To: 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: Ron In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk How identical is "identical"? For example, does diff says that "pg_dump --schema-only" of DB1 and DB2 are perfectly identical? And are the table counts identical? On 10/10/22 08:15, Kostas Papadopoulos wrote: > 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. > > -- Angular momentum makes the world go 'round.