Re: transitive pruning optimization on the right side of a join for partition tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Waldo, Ethan" <ewaldo(at)healthetechs(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: transitive pruning optimization on the right side of a join for partition tables
Date: 2012-09-30 15:14:31
Message-ID: 25559.1349018071@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Waldo, Ethan" <ewaldo(at)healthetechs(dot)com> writes:
> This query does a sequence scan and append across all the partition tables:
> select "dates"."date_description" FROM "myfact" as "myfact", "dates" as "dates" where "myfact"."recorded_on_id" = "dates"."recorded_on_id" and "dates"."recorded_on_id" IN ('4617', '4618', '4619', '4620', '4621', '4622', '4623', '4624', '4625', '4626', '4627', '4628', '4629', '4630', '4631', '4632', '4633', '4634', '4635', '4636', '4637', '4638', '4639', '4640', '4641', '4642', '4643', '4644', '4645', '4646', '4647');

When I try that in 9.1, I get a plan with inner indexscans for each
child table; which, while not exactly what you're asking for, should
perform well enough when the fact table is large enough that
partitioning is actually a useful activity.

I suspect you're committing one of the ten deadly sins of Postgres
optimization, which is to assume that the plan you get on a toy test
case is the same plan you'd get for monster tables. Planning choices
are nonlinear.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Levente Kovacs 2012-09-30 16:54:35 opened connection
Previous Message Tom Lane 2012-09-30 14:51:33 Re: strange permission error