Re: Same query, same data different plan

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Kostas Papadopoulos <kostas(at)methodosit(dot)com(dot)cy>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Daevor The Devoted <dollien(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org, Julien Rouhaud <rjuju123(at)gmail(dot)com>
Subject: Re: Same query, same data different plan
Date: 2022-10-10 17:59:12
Message-ID: cb7aa27b-c0a8-46e5-eb87-b074abfd188f@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/10/22 8:12 AM, Kostas Papadopoulos wrote:
>
> On 10/10/2022 17:53, Tom Lane wrote:
>> Kostas Papadopoulos <kostas(at)methodosit(dot)com(dot)cy> 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.

So there is more to the story.

Information needed:

1) The query and its EXPLAIN ANALYZE for both slow/fast cases.

2) Postgres version.

3) What database are the developers workstation pointing at?

4) What is the test db and is it the same as 3)?

5) What clients are you using to run the query?

>>
>> 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
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message howardnews 2022-10-10 22:25:20 Playing with pgcrypto
Previous Message Kostas Papadopoulos 2022-10-10 15:12:11 Re: Same query, same data different plan