Re: Optimize join selectivity estimation by not reading MCV stats for unique join attributes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Geier <geidav(dot)pg(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Optimize join selectivity estimation by not reading MCV stats for unique join attributes
Date: 2022-11-11 15:16:35
Message-ID: 522124.1668179795@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Geier <geidav(dot)pg(at)gmail(dot)com> writes:
> eqjoinsel() can be optimized by not reading MCV stats if at least one of
> the two join attributes is unique.

There won't *be* any MCV stats for a column that ANALYZE perceives to
be unique, so I'm not quite sure where the claimed savings comes from.

> With this change we saw some queries improve planning time by more than
> 2x, especially with larger values for default_statistics_target.

Please provide a concrete example.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-11-11 15:24:34 Re: A problem about join ordering
Previous Message Pavel Borisov 2022-11-11 15:16:29 Re: Lockless queue of waiters in LWLock