This is something I personally need at dropbox for performance as its more efficient to bind to a single statement rather than recreating many similar INSERT Statements. In my use case, using this improves performance for 1 column string insert from ~0.34 seconds for 10,000 rows in a transaction to ~0.08s for 10,000 rows which is inline (to order of magnitude) with other sqlite benchmarks across the internet like https://medium.com/@JasonWyatt/squeezing-performance-from-sqlite-insertions-971aff98eef2.
Supports all the variations I could see including Encodables and the various syntaxes. There is a slight concern which is that this depends on at least 1 object to find the columns, otherwise, we have to default to some return that makes the API easy to use. eg. it should not return an Insert?. Suggestions welcome here. Added tests as well.
Example usage:
insert many with 1 column: users.insertMany([mail <- "alice@mac.com"], [email <- "geoff@mac.com"])
Feature improvement: ability to insert multiple rows in one statement.
https://github.com/stephencelis/SQLite.swift/issues/168
This is something I personally need at dropbox for performance as its more efficient to bind to a single statement rather than recreating many similar INSERT Statements. In my use case, using this improves performance for 1 column string insert from ~0.34 seconds for 10,000 rows in a transaction to ~0.08s for 10,000 rows which is inline (to order of magnitude) with other sqlite benchmarks across the internet like https://medium.com/@JasonWyatt/squeezing-performance-from-sqlite-insertions-971aff98eef2.
Supports all the variations I could see including
Encodable
s and the various syntaxes. There is a slight concern which is that this depends on at least 1 object to find the columns, otherwise, we have to default to some return that makes the API easy to use. eg. it should not return anInsert?
. Suggestions welcome here. Added tests as well.Example usage:
users.insertMany([mail <- "alice@mac.com"], [email <- "geoff@mac.com"])