Re: Cost Issue - How do I force a Hash Join - Mailing list pgsql-performance

From Tom Lane
Subject Re: Cost Issue - How do I force a Hash Join
Date
Msg-id 4360.1140500155@sss.pgh.pa.us
Whole thread Raw
In response to Cost Issue - How do I force a Hash Join  ("Virag Saksena" <virag@auptyma.com>)
Responses Re: Cost Issue - How do I force a Hash Join
List pgsql-performance
"Virag Saksena" <virag@auptyma.com> writes:
> The individual queries run in 50-300 ms. However the optimizer is =
> choosing a nested loop to join them rather than a Hash join
> causing the complete query to take 500+ seconds. It expects that it will =
> get 1 row out from each of the sources, but here is gets
> several thousand rows.

The best approach is to see if you can't fix that estimation error.
Are the stats up to date on these tables?  If so, maybe raising the
statistics targets would help.

            regards, tom lane

pgsql-performance by date:

Previous
From: "Virag Saksena"
Date:
Subject: Cost Issue - How do I force a Hash Join
Next
From: "Craig A. James"
Date:
Subject: Re: Cost Issue - How do I force a Hash Join