Slow opening SQLite connection in C# app using System.Data.SQLite

I guess my issue is resolved for the moment... I changed both my service and test app to run as the SYSTEM account instead of the NetworkService account. It remains to be seen if the benefits of changing the user account will persist, or if it will only be temporary.


I'm assuming you're using the open source System.Data.SQLite library.

If that's the case, it's easy to see through the Visual Studio Performance Profiler that the Open method of the SQLiteConnection class has some serious performance issues. Also, have a lookthrough the source code for this class here: https://system.data.sqlite.org/index.html/artifact/97648754af51ffd6

There's an awful lot of disk access being made to read XML configuration and Windows environment variable(s).

My suggestion is to try and call Open() as seldom as possible, and try and keep a reference to this open SQLiteConnection object around in memory. A performance ticket is raised with SQLite Forum