Re: bad plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gaetano Mendola <mendola(at)bigfoot(dot)com>
Cc: Richard Huxton <dev(at)archonet(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: bad plan
Date: 2005-03-08 20:01:15
Message-ID: 13634.1110312075@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Gaetano Mendola <mendola(at)bigfoot(dot)com> writes:
>> Since your query is so simple, I'm guessing v_sc_user_request is a view.
>> Can you provide the definition?

> Of course:

I don't think you've told us the whole truth about the v_sc_packages
view. The definition as given doesn't work at all (it'll have
duplicate column names), but more to the point, if it were that simple
then the planner would fold it into the parent query. The subquery
scan node indicates that folding did not occur. The most likely reason
for that is that there's an ORDER BY in the view.

Putting ORDER BYs in views that you intend to use as components of other
views is a bad practice from a performance perspective...

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2005-03-08 20:18:24 Why would writes to pgsql_tmp bottleneck at 1mb/s?
Previous Message Richard Huxton 2005-03-08 19:20:22 Re: bad plan