Re: Force another plan.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fredrik Olsson <fredrik(dot)olsson(at)treyst(dot)se>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Force another plan.
Date: 2006-02-19 17:31:17
Message-ID: 11673.1140370277@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Fredrik Olsson <fredrik(dot)olsson(at)treyst(dot)se> writes:
> -> Seq Scan on t_entities (cost=0.00..1.49 rows=7 width=4)
> (actual time=404.539..409.302 rows=2 loops=1)
> Filter: ((haveaccess(createdby, responsible, "class",
> false) OR CASE WHEN (partof = 'contacts'::name) THEN
> ischildof(ancestorof(me()), "ID") ELSE false END) AND (subplan))
> SubPlan
> -> Function Scan on alleventoccurances
> (cost=0.00..12.50 rows=1000 width=8) (actual time=27.871..27.871 rows=0
> loops=14)

This seems to be your problem right here: evaluating that subplan for
each row of t_entities is pretty expensive, and yet the planner's
estimating a total cost of only 1.49 to run the scan. What PG version
is this? AFAICT we've accounted for subplan costs in scan quals for
a long time, certainly since 7.4. Can you put together a self-contained
test case for this?

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2006-02-19 18:15:07 Re: Question about query planner
Previous Message Emil Briggs 2006-02-19 13:58:12 Question about query planner