2 ms·
One performance benefit of stored procedures in Postgres is that you can perform a multi-statement transaction in the stored procedure, saving the network overh
by grzm 10y ago
One performance benefit of stored procedures in Postgres is that you can perform a multi-statement transaction in the stored procedure, saving the network overhead of multiple round-trips between the application and the database. This may not be a common occurrence for many applications, but it is a legitimate performance benefit when the need arises.
- anarazel 10y agoNote that the network protocol allows pipelining for multiple statements (including transaction control ones), too. Unfortunately only few client libraries (e.g. pgjdbc) make use of that :(
- azernik 10y agoI don't know about Rails and ActiveRecord, but I can do this in Slick.
- kofejnik 10y agoyou can do multi-statement and nested transactions even in Rails