Re: Bad Plan for Questionnaire-Type Query

From: David Blewett <david(at)dawninglight(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Bad Plan for Questionnaire-Type Query
Date: 2009-05-25 15:22:38
Message-ID: 9d1f8d830905250822i7fc2c685ld59178c67cc444c6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sun, May 24, 2009 at 2:42 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> It still feels like this schema design is obscuring correlations that
> the planner needs to know about in order to make decent estimates.

I'm not sure how to make the planner aware of these correlations. Is there
something inherently flawed with this design? It seems pretty close to the
one on the Varlena website [1].

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?
>

Well, I do join the different response tables [text/date/etc] together via
the submission_id. However, in order to be able to apply the where clauses
appropriately, I have to limit the responses to the appropriate
question_id's. Would it matter to push that requirement down to the where
clause instead of part of the join clause?

David

1. http://www.varlena.com/GeneralBits/110.php

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Scott Marlowe 2009-05-25 15:32:20 Re: Problems with autovacuum
Previous Message Shaul Dar 2009-05-25 13:51:59 Putting tables or indexes in SSD or RAM: avoiding double caching?