TLDR to get better performance, use bulk inserts instead of inserting one row per query. And (unrelated to DB perf) don't use the spread operator in JS for passing function args (the author says not to use the spread operator at all but you don't need to go that far)
PG has “copy” which would blow away bulk inserts. Other DB vendors have similar stuff for high-performance inserts. You would be much better off using those than using bulk inserts.
JDBC has "batch updates" feature. You can use single inserts but they're sent as a batch of multiple statements to the database. Not sure about JS libraries, but this feature also significantly improves performance and probably easier to use and maintain.
For super fast inserts you can use postgres COPY feature. But it has to be implemented in the driver.
13 comments
[ 3.1 ms ] story [ 39.0 ms ] threadFor super fast inserts you can use postgres COPY feature. But it has to be implemented in the driver.
[0] - https://avi.im/blag/2021/fast-sqlite-inserts/