Re: materialization blocks hash join - Mailing list pgsql-hackers

From Tom Lane
Subject Re: materialization blocks hash join
Date
Msg-id 21050.1585588395@sss.pgh.pa.us
Whole thread Raw
In response to Re: materialization blocks hash join  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> That's because eqjoinsel_inner won't have any statistics for either side
> of the join, so it'll use default ndistinct values (200), resulting in
> estimate of 0.5% for the join condition.

Right.

> But this should not affect the choice of join algorithm, I think,
> because that's only the output of the join.

Lack of stats will also discourage use of a hash join, because the
default assumption in the absence of stats is that the join column
has a pretty non-flat distribution, risking clumping into a few
hash buckets.  Merge join is less sensitive to the data distribution
so it tends to come out as preferred in such cases.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Corey Huinker
Date:
Subject: Re: Add A Glossary
Next
From: "Tom Turelinckx"
Date:
Subject: Re: snapper vs. HEAD