Re: Correcting Hash Join Estimates - Mailing list pgsql-performance

From Tom Lane
Subject Re: Correcting Hash Join Estimates
Date
Msg-id 17973.1112594057@sss.pgh.pa.us
Whole thread Raw
In response to Correcting Hash Join Estimates  (mark.lubratt@indeq.com)
Responses Re: Correcting Hash Join Estimates
List pgsql-performance
mark.lubratt@indeq.com writes:
> I'm trying to optimize a query and the EXPLAIN ANALYZE (see link below)
> shows that some hash join row estimates are wrong by a factor of 2-3,
> and upwards of 7-8.

I doubt that improving those estimates would lead to markedly better
results.  You need to think about improving the view design instead.
What context is this view used in --- do you just do "select * from
view_get_all_user_award2", or are there conditions added to it, or
perhaps it gets joined with other things?  Do you really need the
DISTINCT constraint?  Do you really need the ORDER BY?  Can you
simplify the WHERE clause at all?

Half a second sounds pretty decent to me for a ten-way join with a WHERE
clause as unstructured as that.  If you really need it to execute in way
less time, you're probably going to have to rethink your data
representation to make the query simpler.

            regards, tom lane

pgsql-performance by date:

Previous
From: mark.lubratt@indeq.com
Date:
Subject: Correcting Hash Join Estimates
Next
From: Mark Lubratt
Date:
Subject: Re: Correcting Hash Join Estimates