Skip to content

Program freezes on 31k row inserts #2836

Answered by simolus3
biblebreeze asked this question in Q&A
Discussion options

You must be logged in to vote

Both here and in your SO question, you're not actually using a batch. Here, there aren't any batches at all. And in the snippet you've posted on SO, there's a batch for each element in the list, so there will be 31k batches instead of the single one you probably intended.
Also, note that list.map((...) async {}) will not await the asynchronous mapping at all, so the try/catch block will also not catch errors made by any query.
Finally, I recommend not using custom statements when the query can be written with type-safe drift APIs instead. If you want use custom statements, you should almost never use string interpolation in them because they make you vulnerable to something called SQL inj…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@biblebreeze
Comment options

@simolus3
Comment options

Answer selected by biblebreeze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants