Re: Error handling in plperl and pltcl
От | Tom Lane |
---|---|
Тема | Re: Error handling in plperl and pltcl |
Дата | |
Msg-id | 447.1100912825@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Error handling in plperl and pltcl (Andrew Dunstan <andrew@dunslane.net>) |
Ответы |
Re: Error handling in plperl and pltcl
|
Список | pgsql-hackers |
Andrew Dunstan <andrew@dunslane.net> writes: > Tom Lane wrote: >> This will slow down the PL SPI call operations in both languages, but >> AFAICS it's the only way to provide error handling semantics that aren't >> too broken for words. > Can you estimate the extent of the slowdown? Without actually doing the work, the closest comparison I can make is between plpgsql functions with and without exception blocks. I tried create or replace function foo(int) returns int as ' declare x int; begin select into x unique1 from tenk1 where unique2 = $1; return x; end' language plpgsql; create or replace function foo(int) returns int as ' declare x int; begin begin select into x unique1 from tenk1 where unique2 = $1; exception when others then null; end; return x; end' language plpgsql; and usedexplain analyze select foo(unique2) from tenk1; to execute each one 10000 times without too much overhead. I get about 6900 vs 12800 msec, so for a simple pre-planned query it's not quite a 50% overhead. This is probably about the worst case you'd see in practice --- unlike plpgsql, plperl and pltcl functions wouldn't be calling the SQL engine to do simple arithmetic, so they're not going to have SPI calls that do much less work than this example does. regards, tom lane
В списке pgsql-hackers по дате отправления: