pl/pgsql slowness

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: pl/pgsql slowness
Date: 2000-11-20 13:28:57
Message-ID: 3A192719.FC222BC8@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Is it normal that a query that takes <1 sec when executed from psql
prompt
takes >15 sek when executed from a function (and takes >95% of cpu for
all that time ?

example (on 7.0.2)

>UPDATE item SET id_path = '';

returns immediately (on 2000 item table)

then I create a function
CREATE FUNCTION "regenerate_id_paths" ( ) RETURNS int4 AS '
BEGIN
UPDATE item SET id_path = '''';
RETURN -1;
END;
' LANGUAGE 'plpgsql';

and then

>select regenerate_id_paths( );

takes more than 15 sec and uses as much cpu as it can get while running;

BTW, where can I learn more about pl/pgsql süntax ?

The postgre docs suggest that "For more complex examples the programmer
might look at the regression
test for PL/pgSQL." but there is only one example using a for loop and
none using while.

I suspect that it may be missing more.

-----------
Hannu

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Larry Rosenman 2000-11-20 15:04:02 err, XLOG/UW711/cc/Doesn't compile.
Previous Message Philip Warner 2000-11-20 13:15:09 Re: Current CVS broken?