Re: Correcting Hash Join Estimates

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mark(dot)lubratt(at)indeq(dot)com
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Correcting Hash Join Estimates
Date: 2005-04-04 05:54:17
Message-ID: 17973.1112594057@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

mark(dot)lubratt(at)indeq(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Mark Lubratt 2005-04-04 06:15:38 Re: Correcting Hash Join Estimates
Previous Message mark.lubratt 2005-04-04 05:08:03 Correcting Hash Join Estimates