As the title suggests, my short question is : When using a dynamically loaded C function with a postgres trigger, is that a blocking or non-blocking call?
Background:
I need to generate some XML following an insert/update/delete on my database. The two options I’ve considered are:
- Create some event table which is written to using during an I/U/D operation and have a daemon poll for these events and generate XML
- Create a C function to generate this XML as part of a trigger in postgres.
Using option 2 would provide real-time updates but my concern is that there will be some overhead in generating the XML message and transmitting it etc, so inserting 100rows would take a lot longer due to creating an xml between each operation.
Yes, it “blocks”. The SQL that causes the trigger to run does not complete until the trigger is done.
See more info in the docs.