Re: function slower than the same code in an sql file

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Rodrigo Gonzalez <rjgonzale(at)estrads(dot)com(dot)ar>
Cc: CS DBA <cs_dba(at)consistentstate(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)postgresql(dot)org
Subject: Re: function slower than the same code in an sql file
Date: 2011-11-03 15:40:30
Message-ID: CA+TgmoYbFUu8drAAgmPjR5Lo9v1TPTyJgOhHrK8yoguZMZWMvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, Nov 3, 2011 at 11:31 AM, Rodrigo Gonzalez
<rjgonzale(at)estrads(dot)com(dot)ar> wrote:
> El 03/11/11 11:42, Robert Haas escribió:
>
> On Fri, Oct 28, 2011 at 9:39 AM, CS DBA <cs_dba(at)consistentstate(dot)com> wrote:
>
> No parameters,  one of them looks like this:
>
> [ code snippet ]
>
> It's hard to believe this is the real code, because SELECT without
> INTO will bomb out inside a PL/pgsql function, won't it?
>
> But he's using CREATE TABLE xyz_view_m AS
>
> So it seems correct to me

Oh, right, I missed that.

That seems pretty mysterious then. But is it possible the function is
getting called more times than it should? I notice that it's set up
as a trigger; is it FOR EACH ROW when it should be a statement-level
trigger or something like that? Maybe run EXPLAIN ANALYZE on the
query that's invoking the trigger to get some more detail on what's
going on?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message siva palanisamy 2011-11-03 15:52:42 Optimization required for multiple insertions in PostgreSQL
Previous Message Robert Haas 2011-11-03 15:35:00 Re: Query running a lot faster with enable_nestloop=false