Re:Let Postgres Do the Work (2013)
by grzm on Saturday November 26, 2016 @04:38PM
(#13046023)
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.
[ Parent
| on HN ]
Note 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 :(
I don't know about Rails and ActiveRecord, but I can do this in Slick.