pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gaetano Mendola <mendola@bigfoot.com>
Cc: Richard Huxton <dev@archonet.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: bad plan
Date: Tue, 08 Mar 2005 15:01:15 -0500
Message-ID: <13634.1110312075@sss.pgh.pa.us> (raw)
In-Reply-To: <422D9904.5010904@bigfoot.com>
References: <422D7F23.7000109@bigfoot.com>
	<422D8F0E.8000906@archonet.com>
	<422D9904.5010904@bigfoot.com>

Gaetano Mendola <mendola@bigfoot.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



view thread (19+ messages)  latest in thread

Message-ID: <13634.1110312075@sss.pgh.pa.us>
Permalink:  ../13634.1110312075@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13634.1110312075@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mendola@bigfoot.com, dev@archonet.com
  Subject: Re: bad plan
  In-Reply-To: <13634.1110312075@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox