Re: Problem with inherited tables vs query planning

From: "Dave Golombek" <daveg(at)blackducksoftware(dot)com>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problem with inherited tables vs query planning
Date: 2007-05-18 14:34:48
Message-ID: 20070518143534.5CE615C4512@smtp.blackducksoftware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane writes:
> "Dave Golombek" <daveg(at)blackducksoftware(dot)com> writes:
> > Is there a way I can reformulate the query to help the planner use the
> > indices?
>
> Use 8.2. Also put an index on the base table, not only the children ---
> the forced seqscan on the base weighs down the cost estimate for the
> plan you would like to have. (With sufficiently large child tables,
> that might not matter, but it sure does for this toy example.)

Ah, I forgot to try the index on the base table using 8.2, which does indeed
solve the problem. It unfortunately doesn't help with 8.1.4, which we have
in the field; any thoughts on workarounds for older versions or should I
just use a function until we can upgrade everywhere? We have 150 million
rows spread across 16 child tables, which should help cost estimation.

Thanks,
Dave

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2007-05-18 14:45:22 Re: Data replication through disk replication
Previous Message Andrew Sullivan 2007-05-18 14:29:03 Re: Fault Tolerant Postgresql (two machines, two postmasters, one disk array)