Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does RAISE NOTICE 'text' in triggers slow down queries in Postgresql?

When I'm testing my query triggers, I see that the query execution time increase when I'm putting a lot of "RAISE NOTICE ... " in the trigger code. Does this time increase also when I'm calling this queries in my softwares without displaying output in the messages windows or it's only when the messages output is attached?

like image 391
Andrea Cattaneo Avatar asked Oct 19 '22 10:10

Andrea Cattaneo


1 Answers

Based on my own experience with plpgSQL, I would say yes. And according to the authors of the book PostgreSQL Server Programming - Second Edition (by Usama Dar, Hannu Krosing, Jim Mlodgenski, Kirk Roybal):

[...] The RAISE statements need to be written, commented out, and restored when needed.[...] They also slow down the execution of the routine.[...]

p.134

enter image description here

like image 142
Proghero Avatar answered Oct 21 '22 05:10

Proghero