Re: HashJoin order, hash the large or small table? Postgres likes to hash the big one, why? - Mailing list pgsql-performance

From pasman pasmański
Subject Re: HashJoin order, hash the large or small table? Postgres likes to hash the big one, why?
Date
Msg-id BANLkTinVrHwVu_8-uqqc8U8zMGU6ihrRBg@mail.gmail.com
Whole thread Raw
List pgsql-performance
hi.

>I think you're missing the point, which is that all the hash work is
>just pure overhead in such a case (and it is most definitely not
>zero-cost overhead).  You might as well just do a nestloop join.
>Hashing is only beneficial to the extent that it allows a smaller subset
>of the inner relation to be compared to each outer-relation tuple.
>So I think biasing against skew-distributed inner relations is entirely
>appropriate.


Scanning smaller relation first is better with cursors.
First rows from query are returned faster in this case.
Maybe add this optimization for cursors only?



------------
pasman

pgsql-performance by date:

Previous
From: Václav Ovsík
Date:
Subject: Re: poor execution plan because column dependence
Next
From: Mark Williams
Date:
Subject: Bad Query Plan with Range Query