Skip site navigation (1) Skip section navigation (2)

Bad Plan for Questionnaire-Type Query

From: David Blewett <david(at)dawninglight(dot)net>
To: pgsql-performance(at)postgresql(dot)org
Subject: Bad Plan for Questionnaire-Type Query
Date: 2009-05-07 16:53:06
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
I have a query [1] that Postgres is insisting on using a Nested Loop
for some reason when a Hash Join is much faster. It seems like the
estimates are way off. I've set default_statistics_target to 250, 500,
1000 and analyzed, but they never seem to improve. If I disable
nestloops, the query completes in around 3-5s. With them enabled, it
takes anywhere from 45 to 60 seconds. Here is the DDL for the tables
and the month_last_day function [4].

Any help would be appreciated!

David Blewett



pgsql-performance by date

Next:From: David BlewettDate: 2009-05-07 17:28:14
Subject: Re: Bad Plan for Questionnaire-Type Query
Previous:From: Nikolas EverettDate: 2009-05-07 15:37:52
Subject: Re: Slow select performance despite seemingly reasonable query plan

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group