Re: RAISE INFO in function

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: RAISE INFO in function
Дата
Msg-id CAFj8pRCrtn8sdYWgH-2rVq1aWAYH+BSjb+NME2nY3jdP9wbmYw@mail.gmail.com
обсуждение исходный текст
Ответ на RAISE INFO in function  (Yambu <hyambu@gmail.com>)
Список pgsql-general


po 9. 11. 2020 v 14:46 odesílatel Yambu <hyambu@gmail.com> napsal:
Hi

May i know if RAISE INFO impacts performance significantly in a function?

Should i comment them out once i'm done using/debugging ?

It depends on more factors - but expressions in RAISE statements are calculated every time and sometimes the result can be filtered. Inside cycles or when functions is evaluated for every row of query, then the overhead can be significant:

postgres=# do $$
begin
  for i in 1..100000 loop
    raise debug '%', i;
  end loop;
end;
$$;
DO
Time: 35,164 ms
postgres=# do $$
begin
 -- plpgsql cannot to ignore empty blocks, this loop was evaluated 100K
  for i in 1..100000 loop
    --raise debug '%', i + 1;
  end loop;
end;
$$;
DO
Time: 2,535 ms

Regards

Pavel


regards

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

Предыдущее
От: "Buzenets, Yuriy (GE Renewable Energy, consultant)"
Дата:
Сообщение: Database system was interrupted. Possible reasons for a database to suddenly stop accepting connections?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Database system was interrupted. Possible reasons for a database to suddenly stop accepting connections?