pl/pgsql slowness

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема pl/pgsql slowness
Дата
Msg-id 3A192719.FC222BC8@tm.ee
обсуждение исходный текст
Ответы Re: pl/pgsql slowness  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Ivan E. Panchenko"
Дата:
Сообщение: Indexing on arrays
Следующее
От: Larry Rosenman
Дата:
Сообщение: err, XLOG/UW711/cc/Doesn't compile.