pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: josh@agliodbs.com
Cc: PgSQL Performance ML <pgsql-performance@postgresql.org>
Subject: Re: complicated queries in pl/pgsql
Date: Wed, 15 Jan 2003 20:12:28 +0100
Message-ID: <3E25B29C.9040408@klaster.net> (raw)
In-Reply-To: <3E23EC83.9060802@klaster.net>
References: <3E23EC83.9060802@klaster.net>
	<200301131044.50424.josh@agliodbs.com>

Josh Berkus wrote:

 >  Tomasz,
 >
 >
 > >What happens to view planning - is it performed
 > >during view creation, or rather each time view is quered?
 >
 >
 > Each time the view is executed.   The only savings in running a view 
over a
 > regular query is that the view will have taken care of some reference
 > expansion and JOIN explication during the CREATE process, but not 
planning.
 > Also, views can actually be slower if the view is complex enough that 
any
 > query-time parameters cannot be "pushed down" into the view.

Thanks a lot.
I'm asking, because I use some queries which are easy to change into 
views. Most of their execution time takes planning, they use 5-10 
explicit table joins with not too many rows in these tables and returns 
few values.

Now I know, that queries inside pl/pgsql functions are better in these 
situations:
- complex queries whith deep parameters
- execution several times during conection lifetime.

Can anyone add something?

Tomasz Myrta




view thread (4+ messages)

Message-ID: <3E25B29C.9040408@klaster.net>
Permalink:  ../3E25B29C.9040408@klaster.net/
Also on:    postgresql.org/message-id/3E25B29C.9040408@klaster.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: jasiek@klaster.net, josh@agliodbs.com
  Subject: Re: complicated queries in pl/pgsql
  In-Reply-To: <3E25B29C.9040408@klaster.net>
  References: <3E23EC83.9060802@klaster.net> <200301131044.50424.josh@agliodbs.com> <3E25B29C.9040408@klaster.net>

* 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