From: | Imre Samu <pella(dot)samu(at)gmail(dot)com> |
---|---|
To: | Kostas Papadopoulos <kostas(at)methodosit(dot)com(dot)cy> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Same query, same data different plan |
Date: | 2022-10-10 13:24:38 |
Message-ID: | CAJnEWwnm+zCibMcfBV=5CpE0TzY8Gss+RQ8PTcEL8iFhV4igPw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> Ran analyze on both. Running the same query I'm getting different plans,
one x10 slower.
theory:
the "statistics target" is too low ?
THEN
different random sample --> different statistics ---> different plan,.
*"For large tables, ANALYZE takes a random sample of the table contents,
rather than examining every row. "*
https://www.postgresql.org/docs/current/sql-analyze.html
IMHO: Try to increase the statistics target (
"default_statistics_target" , .. )
regards,
Imre
Kostas Papadopoulos <kostas(at)methodosit(dot)com(dot)cy> ezt írta (időpont: 2022.
okt. 10., H, 14:56):
>
> I have two identical databases running in the same instance of Postgresql.
> Ran
> analyze on both. Running the same query I'm getting different plans, one
> x10 slower.
> Although I have solved my problem by re-writing the query, I want to
> understand why
> this is happening. If the configuration, Postgresql version, schema and
> data are the
> same, what other factors is the planner considering?
>
> --
>
> Kostas Papadopoulos
> KE MethodosIT
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Ron | 2022-10-10 13:44:00 | Re: Same query, same data different plan |
Previous Message | Kostas Papadopoulos | 2022-10-10 13:23:43 | Re: Same query, same data different plan |