0

I am using the amalgamation version 3.27.0 compiled with SQLITE_DEFAULT_SYNCHRONOUS=0, which ought to be the same as executing PRAGMA synchronous=off (but I am not executing this statement in my code, as I assumed the macro setting would be respected).

What happened was the infamous INSERT delay after setting a number of rows. Wrapping in BEGIN/COMMIT solved the problem, as per the FAQ and this answer, but I am left wondering. Is SQLITE_DEFAULT_SYNCHRONOUS ignored when compiling the amalgamation (i.e. I should not be noticing a delay with synchronous set to off)? . It does not seem that way when I look into the source code. In addition, I am enabling WAL on the database with PRAGMA journal_mode=WAL, which should be speeding up the inserts even more, but maybe doing so changes the synchronous pragma?

EDIT: If I execute PRAGMA synchronous in my program, sqlite returns 0.

user1095108
  • 14,119
  • 9
  • 58
  • 116
  • 1
    Perhaps related to ***Unfortunately, most consumer-grade mass storage devices lie about syncing.*** [https://www.sqlite.org/howtocorrupt.html#_disk_drives_that_do_not_honor_sync_requests](https://www.sqlite.org/howtocorrupt.html) – MikeT Feb 15 '19 at 20:44
  • I think, even if `PRAGMA synchronous` is 0, transactions bring some performance benefit. Now I added batching and it's even faster. Maybe I falsely thought that defining `SQLITE_DEFAULT_SYNCHRONOUS` as 0 would solve all problems. – user1095108 Feb 16 '19 at 00:36

0 Answers0