Skip to content

Some questions about context handling #203

Description

@stephan0h

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions