Re: Major performance degradation with joins in 15.8 or 15.7?

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: Ed Sabol <edwardjsabol(at)gmail(dot)com>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Major performance degradation with joins in 15.8 or 15.7?
Date: 2024-11-08 02:54:10
Message-ID: b98a67c1-93db-40d7-a3bb-61ec51a80f55@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 11/8/24 09:45, Ed Sabol wrote:
> On Nov 7, 2024, at 9:27 PM, Andrei Lepikhov <lepihov(at)gmail(dot)com> wrote:
>> Postgres didn't want Materialize in this example because of the low estimation on its outer subquery. AFAIC, by increasing the *_page_cost's value, you added extra weight to the inner subquery
> What kind of extended statistics do you suggest for this? ndistinct, dependencies, or mcv?
>
> CREATE STATISTICS tablename_stats (<statistics type?>) ON relation, type FROM tablename;
> ANALYZE tablename;
I'd recommend to use all of them - MCV is helpful in most of the cases
(and relatively cheap), distinct is actually used in Postgres now to
calculate number of groups (GROUP-BY, Sort, Memoize, etc.); dependencies
- to find correlations between columns - usually in scan filters.

--
regards, Andrei Lepikhov

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Achilleas Mantzios 2024-11-08 19:32:26 tds_fdw : Severe performance degradation from postgresql 10.23 to 16.4
Previous Message Ed Sabol 2024-11-08 02:45:37 Re: Major performance degradation with joins in 15.8 or 15.7?