From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Yambu <hyambu(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: RAISE INFO in function |
Date: | 2020-11-09 14:20:48 |
Message-ID: | CAFj8pRCrtn8sdYWgH-2rVq1aWAYH+BSjb+NME2nY3jdP9wbmYw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
po 9. 11. 2020 v 14:46 odesílatel Yambu <hyambu(at)gmail(dot)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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2020-11-09 14:29:25 | Re: Database system was interrupted. Possible reasons for a database to suddenly stop accepting connections? |
Previous Message | Buzenets, Yuriy (GE Renewable Energy, consultant) | 2020-11-09 13:53:28 | Database system was interrupted. Possible reasons for a database to suddenly stop accepting connections? |