Re: complicated queries in pl/pgsql

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: josh(at)agliodbs(dot)com
Cc: PgSQL Performance ML <pgsql-performance(at)postgresql(dot)org>
Subject: Re: complicated queries in pl/pgsql
Date: 2003-01-15 19:12:28
Message-ID: 3E25B29C.9040408@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tomasz Myrta 2003-01-15 19:31:34 Re: 7.3.1 New install, large queries are slow
Previous Message Roman Fail 2003-01-15 18:00:04 7.3.1 New install, large queries are slow