sqlite perf: keep cache of database instead of reopening