ffraenz
ffraenz
DTDrizzle Team
Created by ffraenz on 8/6/2024 in #help
On inserting many, many rows
In the documentation, the following insert with multiple rows is described:
await db.insert(users).values([{ name: 'Andrew' }, { name: 'Dan' }]);
await db.insert(users).values([{ name: 'Andrew' }, { name: 'Dan' }]);
In a project of mine, an insert query grew to 10k rows to be inserted at once. So, I was wondering, if it is good practice to throw this whole thing at the insert query or if I am responsible to batch the inserts to smaller more reasonable chunks? I am using Postgres. Thank you for any hint on this topic.
8 replies