On 09/21/2016 04:34 AM, Yuri wrote:
I import bulk data into SQLite DB. I run 50k records per transaction.


When some bug or data inconsistency occurs and causes the key violation, this violation is reported only in the end of the transaction (this is okay and has been discussed before).

But I also notice that the transaction (a batch of 50k records) with the failed key is much slower compared to when there is no key violation.


I think this is a bug. There is something that is slowing the transaction when there is a pending key violation. It should either report the violation immediately (which it doesn't do), or keep going with the same speed. The way how it is now it just slows the process of finding a problem without any apparent reason.

It sounds like you are using deferred FK constraints. To have SQLite report the violation at the end of the statement, use an immediate FK constraint:

  https://www.sqlite.org/foreignkeys.html#fk_deferred

Dan.


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to