Hello,
I recently enabled pghistory.middleware.HistoryMiddleware to track who is changing what. Now my colleague was alarmed because there are so many more queries. He stumbled across the calls to set_config(). So I did some research.
Why is it necessary to call set_config() for each and every SQL-statement - even selects? Because I would assume that context info is only necessary for inserts/updates/deletes when the triggers are actually writing to the event tables.
The next question is (I have not tested yet): does this have any performance implications? I suppose a call to set_config() is cheap - but is it causing extra round trips to the database?
Thanks for enlightening me :-)
Kind regards,
Stephan
Hello,
I recently enabled pghistory.middleware.HistoryMiddleware to track who is changing what. Now my colleague was alarmed because there are so many more queries. He stumbled across the calls to set_config(). So I did some research.
Why is it necessary to call set_config() for each and every SQL-statement - even selects? Because I would assume that context info is only necessary for inserts/updates/deletes when the triggers are actually writing to the event tables.
The next question is (I have not tested yet): does this have any performance implications? I suppose a call to set_config() is cheap - but is it causing extra round trips to the database?
Thanks for enlightening me :-)
Kind regards,
Stephan