it doesn’t seem there is any support for a bulk in...
# squarelibraries
w
it doesn’t seem there is any support for a bulk insertion in sqldelight. besides doing them in a transaction is there anything else i should do to minimize the impact of multiple inserts?
k
This might be helpful if you’re using SQLite. It’s a different story if you’re using a client-server DB, though.
h
What’s wrong with a transaction?
w
i assume it is less efficient than a bulk insert. i need to benchmark to confirm
i’m using postgres
k
I think that when using a client-server db bulk inserts will perform better because it doesn't have to make many network round trips for each insert. There may be optimization here in the underlying PG driver that I'm unaware of, though.
g
Sadly, for JDBC there isn’t much you can do as the Batch api is not exposed in sqldelight, also a preparedStatement object is created each time - a question was asked the other day https://github.com/cashapp/sqldelight/issues/5364 Also -
COPY
is supported in the Postgresql grammar, if that would fit your needs.