Postgres Trigger Tests

January 23, 2022

We already know statement-level INSERT triggers are faster than row-level triggers in Postgres.

Out of curiosity I decided to time row-level and statement-level INSERT triggers with a variety of row counts.

Here are the results:

Row Count vs Query Time

Row Count vs Query Time

The takeaway here is that if speed is a concern, then you should prefer statement-level triggers to row-level triggers.

The scripts used to create the test database, run the tests, and generate the results are available in the companion GitHub repository.