> But yes, if you have an application which uses only the backup API it should be safe.
I have added SQLITE_OPEN_EXCLUSIVE to the flags of the backup db. That should cover accidental cases where the backup db is opened before or during the backup by "something else" ? It should never happen in my case, but probably best to leave it in case of copy-pasta later. > A backup simply copies all pages. It accesses each page once, so all cache lookups will fail. Yes, but a 20% performance hit for a 2000 entries cache semed a bit steep, given that a backup should be I/O bound. After looking with a profiler, it seems that the extra time spent seems in ntdll.dll, not SQLite itself. The source cache_size has an impact but small, the main impact is for the destination cache_size. Also of note, the backup operation can take about half of a CPU core (a fast E3 core at 3.5 GHZ). Eric On Wed, Oct 5, 2016 at 12:50 PM, Clemens Ladisch <clem...@ladisch.de> wrote: > Eric Grange wrote: > > Ran some tests with variations of Clemens's backup exemple, and adding > > > > sqlite3_exec(src, "PRAGMA cache_size=1", NULL, NULL, NULL); > > sqlite3_exec(dst, "PRAGMA cache_size=1", NULL, NULL, NULL); > > > > seems to provide the best performance [...] > > > > While the effect of synchronous=OFF on the destination backup db was > > something I expected, the cache_size of 1 was not. > > > > Using large cache_size had a detrimental effect, both on source or > > destination, between cache_size 1 and the default of SQLite (-2000) there > > is a 20% difference in performance during backup. > > A backup simply copies all pages. It accesses each page once, so all > cache lookups will fail. > > > Regards, > Clemens > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users