Yes VACUUM in a separate connection is safe. It will still have to wait for locks held by the old connection to clear before it can proceed, and while it is running it will prevent other write transactions (and eventually read transactions) from starting (they'll fail with SQLITE_BUSY). Note it's generally advisable to have an sqlite connection used by only one thread at a time, as transactionality gets hard to reason about if you have a bunch of threads interleaving different queries. Transactions happen at the connection level not the thread level. Also note it is possible to determine what statement(s) are currently active via the [`sqlite3_next_stmt()`](https://sqlite.org/c3ref/next_stmt.html) interface or the [`SQLITE_STMT`](https://www.sqlite.org/stmt.html) virtual table.