public inbox for [email protected]
help / color / mirror / Atom feedFrom: Ed Sabol <[email protected]>
To: Andrei Lepikhov <[email protected]>
Cc: [email protected]
Subject: Re: Major performance degradation with joins in 15.8 or 15.7?
Date: Thu, 7 Nov 2024 21:45:37 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<CAApHDvr8c4-unAVysqMgz0mWO=PZ_WAGprq-jwND5+C_OO8SYg@mail.gmail.com>
<[email protected]>
<[email protected]>
On Nov 7, 2024, at 9:27 PM, Andrei Lepikhov <[email protected]> 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 and shifted the decision to use materialisation.
Interesting, except I decreased the random_page_cost. Just clarifying.
> I see huge underestimation in the simple scan:
>
> Bitmap Heap Scan on metainfo b_1
> (cost=23.96..35.77 rows=3 width=38)
> (actual time=1.225..4.206 rows=1025 loops=1)
>
> It may be caused by some functional dependency in its filter:
>
> ((relation = 'located'::text) AND (type = 'document'::text))
>
> You can create extended statistics on the columns 'relation' and 'type'. These statistics can reduce estimation errors and enable the optimiser to find a better plan without changing the cost balance.
OK, this is the first I'm learning about extended statistics...
I'm looking at https://www.postgresql.org/docs/15/sql-createstatistics.html
and https://www.postgresql.org/docs/15/planner-stats.html#PLANNER-STATS-EXTENDED
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;
Thanks,
Ed
view thread (8+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Major performance degradation with joins in 15.8 or 15.7?
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox