Re: RAISE INFO in function - Mailing list pgsql-general

From Pavel Stehule
Subject Re: RAISE INFO in function
Date
Msg-id CAFj8pRCrtn8sdYWgH-2rVq1aWAYH+BSjb+NME2nY3jdP9wbmYw@mail.gmail.com
Whole thread Raw
In response to RAISE INFO in function  (Yambu <hyambu@gmail.com>)
List 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 by date:

Previous
From: "Buzenets, Yuriy (GE Renewable Energy, consultant)"
Date:
Subject: Database system was interrupted. Possible reasons for a database to suddenly stop accepting connections?
Next
From: Adrian Klaver
Date:
Subject: Re: Database system was interrupted. Possible reasons for a database to suddenly stop accepting connections?