Re: How to get explain plan to prefer Hash Join - Mailing list pgsql-performance

From Nicholson, Brad (Toronto, ON, CA)
Subject Re: How to get explain plan to prefer Hash Join
Date
Msg-id EC55DC235432104F8255702A8D7344D951EEC259@G4W3211.americas.hpqcorp.net
Whole thread Raw
In response to How to get explain plan to prefer Hash Join  (atxcanadian <matthew.boyda@gmail.com>)
List pgsql-performance
> -----Original Message-----
> From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-
> owner@postgresql.org] On Behalf Of atxcanadian
> Sent: Wednesday, March 11, 2015 1:01 PM
> To: pgsql-performance@postgresql.org
> Subject: [PERFORM] How to get explain plan to prefer Hash Join
>
> Currently seeing massive increase in performance when optimizer chooses
> Hash Join over Nested Loops. I achieve this by temporarily setting nested loops
> off. I'd like to setup some database variables where the optimizer prefers hash
> joins. Any suggestions?

Try making small adjustments to either random_page_cost or cpu_tuple_cost.  They can influence the planners choice
here. I have solved similar issues in the past by adjusting one or the other.  Be aware thought that those changes can
havenegative effects in other places, so be sure to test. 

Brad.


pgsql-performance by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: EXPLAIN (no ANALYZE) taking an hour for INSERT FROM SELECT
Next
From: Jeff Janes
Date:
Subject: Re: How to get explain plan to prefer Hash Join