On 9/19/09 5:08 PM, Michael Korbakov wrote: > -> Hash Join (cost=8.50..25.11 rows=1 > width=28) (actual time=0.092..1.864 rows=560 loops=1) > Hash Cond: > (((partners_shares.year)::double precision = (shares.year)::double > precision) AND ((partners_shares.month)::double precision = > (shares.month)::double precision)) This appears to be where the estimates go wrong; Postgres may be assuming random correlation which isn't correct. My suggestion would be to try and create matching indexes on date_trunc(daily_domain_reports.date) and month & year of monthly_shares_with_parents_materialized. -- Josh Berkus PostgreSQL Experts Inc. www.pgexperts.com -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance