Since you’re doing a whole bunch at once in a loop, you probably will want to wrap the entire loop in a transaction. Otherwise sqlite will issues a transaction per insert, meaning it’ll have to flush to disk each time. Not sure if your library supports transactions directly. If not, prepare a statement of “BEGIN TRANSACTION” and “COMMIT” to issue before and after respectively.
1 Like