J jtare Active Member Licensed User Longtime User Oct 11, 2017 #1 It is possible to run asynchronously "vacuum" in SQL? specifically in SQLCipher? Doing a vacuum take so much time and freezes the app, so I'm trying to run it asynchronously using the following code: From the KeyValueStore class module: Code: Copy Public Sub vacuum sql1.AddNonQueryToBatch("VACUUM",Null) Dim SenderFilter As Object = sql1.ExecNonQueryBatch("SQL1") Wait For (SenderFilter) SQL1_NonQueryComplete (Success As Boolean) Log("NonQuery: " & Success) End sub I don't know if this is right, it happens super fast, the log(success) triggers immediately. But if I run it non async "sql1.ExecNonQuery("VACUUM")" it takes way more time like if its actually doing something, with the async method it seems to be doing nothing.
It is possible to run asynchronously "vacuum" in SQL? specifically in SQLCipher? Doing a vacuum take so much time and freezes the app, so I'm trying to run it asynchronously using the following code: From the KeyValueStore class module: Code: Copy Public Sub vacuum sql1.AddNonQueryToBatch("VACUUM",Null) Dim SenderFilter As Object = sql1.ExecNonQueryBatch("SQL1") Wait For (SenderFilter) SQL1_NonQueryComplete (Success As Boolean) Log("NonQuery: " & Success) End sub I don't know if this is right, it happens super fast, the log(success) triggers immediately. But if I run it non async "sql1.ExecNonQuery("VACUUM")" it takes way more time like if its actually doing something, with the async method it seems to be doing nothing.
Erel B4X founder Staff member Licensed User Longtime User Oct 12, 2017 #2 Quoting: http://www.sqlite.org/lang_vacuum.html A VACUUM will fail if there is an open transaction, or if there are one or more active SQL statements when it is run. sql1.ExecNonQueryBatch creates an explicit transaction so it will not work. Try it with sql1.ExecQueryAsync Upvote 0
Quoting: http://www.sqlite.org/lang_vacuum.html A VACUUM will fail if there is an open transaction, or if there are one or more active SQL statements when it is run. sql1.ExecNonQueryBatch creates an explicit transaction so it will not work. Try it with sql1.ExecQueryAsync