为了防止清除sqlite内存数据库,必须使用相同的连接来访问数据库.但是,使用相同的连接会导致sqlite同步对数据库的访问.因此,如果我有许多线程对内存数据库执行读取,则在多核计算机上它比针对文件支持的数据库运行的完全相同的代码要慢.
答案是不.我询问了sqlite用户组,得到了Pavel Ivanov的以下回复:
No,sqlite doesn’t support full concurrent access to any database. The only concurrency you can earn is having on-disk database without shared cache (so actually having several copies of the database in memory). Of course I don’t consider option of concurrency from different processes.