I am trying to insert 10000 records and its taking 45 secs
this is my code
println(NSDate.new())
for index in 0...10000{
countrys.insert(name <- "abc")
//println(index)
}
println(NSDate.new())
is this way to do it?
I am trying to insert 10000 records and its taking 45 secs
this is my code
println(NSDate.new())
for index in 0...10000{
countrys.insert(name <- "abc")
//println(index)
}
println(NSDate.new())
is this way to do it?
The issue is that SQLite will have to commit each of the
INSERT
statements individually. You should consider using transactions. You can start a transaction withtransaction
method (which performsBEGIN TRANSACTION
SQL) and then usecommit
to commit them (which performsCOMMIT
SQL).For example: