On 22 Apr 2019, at 7:39pm, Lee, Jason <jason...@lanl.gov> wrote: > Hi. Are there any gotchas when opening multiple independent databases from > within one process using the C API? I am opening one database per thread in > my code, and noticed that sqlite3_open_v2 and sqlite3_close slow down as the > number of threads increase, indicating there might be some resource > contention somewhere, even though the databases should be independent of each > other.
SQLite is designed to cope with the opening of many different databases at the same time. SQLite does not maintain its own list of open connections, so it doesn't have to iterate through the list each time you execute another command. Those routines will get slower, since your operating system keeps a list of open files and has to walk through the list. But that should be tiny and unnoticeable in any modern OS. Can you give us any numbers as examples ? I presume your setup gives you one thread per database. Are you sure that this slowdown is not just the result of some OS function, i.e. you've run out of real memory and the OS has to keep swapping every time you switch to another thread ? _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users