In my app I do multi-row inserts when I can just because it reduces the number of round trips between the db and the app.
However, I was curious, is there any other advantages? For example, if multiple rows are inserted at once like this:
insert into tbl (c1, c2) values
(v1, v2)
(v3, v4)
versus:
insert into tbl (c1, c2) values (v1, v2)
insert into tbl (c1, c2) values (v3, v4)
and the table has an index, is the index calculated once in the first case, and twice in the second case? Or is it always once per insert? Assume that both queries are in the same transaction.
I'm using PostgreSQL.