On Fri, May 29, 2015 at 8:48 AM, Dan Kennedy <danielk1977 at gmail.com> wrote:
> On 05/29/2015 12:59 PM, Zaumseil Ren? wrote: > >> On 05/27/2015 11:59 PM, Wade, William wrote: >> >>> But instead of using a regular SQL transaction to drop all the old >>> tables, use the backup API to clobber the existing database with the new >>> one. >>> >>> https://www.sqlite.org/c3ref/backup_finish.html >>> >>> Using the backup API, the clobber operation is still done as a regular >>> SQLite transaction - so all the locking and notifying of other clients >>> gets done right. The amount of IO (and CPU) required should depend on >>> the size of the new db only, not the existing db size. And it won't >>> matter if the existing db is corrupt or not - as the backup API never >>> actually examines the contents of the existing database. >>> >> Interesting idea. Could this also a solution to my problem described in >> the thread "emptying tables"? >> > > Maybe. Using the backup API to clobber one database with another featuring > a bunch of empty tables is likely quicker than actually deleting all the > data from the original. Dan, can you please explain quickly why? Does the backup API work at the page level for example, and thus is more efficient than normal row level ops? Thanks, --DD