Re: View vs Stored Proc Performance

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Jason Tesser <jasontesser(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: View vs Stored Proc Performance
Date: 2009-09-11 21:53:20
Message-ID: b42b73150909111453l73467547j485aa6d90f68fa99@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Sep 11, 2009 at 5:27 PM, Jason Tesser <jasontesser(at)gmail(dot)com> wrote:
> Right what I was wondering is is this better done in a view? or a stored
> proc?   I am guessing based on your initial response the view is better
> performance.  These are the types of queries I will be doing though.
>

in performance terms the view should be faster if you are doing things
like joining the result to another table...the planner can see
'through' the view, etc. in a function, the result is fetched first
and materialized without looking at the rest of the query. the actual
mechanism you use to build the arrays is likely going to be more
important than anything else.

merlin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Merlin Moncure 2009-09-11 21:55:09 Re: slow query : very simple delete, 100% cpu, nearly no disk activity
Previous Message Robert Haas 2009-09-11 21:30:37 Re: slow query : very simple delete, 100% cpu, nearly no disk activity