Re: Bad Plan for Questionnaire-Type Query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Blewett <david(at)dawninglight(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Bad Plan for Questionnaire-Type Query
Date: 2009-05-24 18:42:02
Message-ID: 27080.1243190522@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

David Blewett <david(at)dawninglight(dot)net> writes:
> I took the time to load this data into an 8.4beta2 install, and the same
> query runs in a much more reasonable timeframe (~3s as opposed to ~50s). I
> set the statistics target to 500, and got this explain [1].
> 1. http://explain.depesz.com/s/pw

Hmm... the join size estimates are no better than before, so I'm afraid
that 8.4 is just as vulnerable to picking a bad plan as the previous
versions were. I don't think you should assume anything's been fixed.

It still feels like this schema design is obscuring correlations that
the planner needs to know about in order to make decent estimates.
You mentioned earlier that the seemingly unrelated question_ids were
linked via a common submission_id. I wonder whether it's possible to
query using the submission_id instead?

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Łukasz Jagiełło 2009-05-24 19:46:38 Problems with autovacuum
Previous Message Frank Joerdens 2009-05-23 00:13:08 Re: Full statement logging problematic on larger machines?