If the database schema is not small then use opening a connection does make
a difference.  In initial testing we found opening a connection with 100
simple test tables take 3 ms.  Later testing with our actual schema which
has fewer tables but is more complex takes 17ms (~65 tables with indexes and
foreign key triggers).

Also that's just opening time.  The cache is stored as part of the
connection so you'll see additional benefits through use with a single
connection as opposed to multiple connections.  

HTH,

Sam


-------------------------------------------
We're Hiring! Seeking a passionate developer to join our team building
products. Position is in the Washington D.C. metro area. If interested
contact [EMAIL PROTECTED]
 
-----Original Message-----
From: Gil Delavous [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 22, 2007 7:59 AM
To: [email protected]
Subject: [sqlite] Holding sqlite connection

Hi,

I was wondering if its better to open a sqlite database connection when my  
application launches, use it all along the process life, and closing it  
when it exits... or if its better to open/close the database connection  
each time a method has to query/store data, thus leaving the database not  
open all the time.

As my application is multithreaded (each thread open its own, global  
connection too) I'm not sure if holding connections is the best way to  
avoid conflicts (I sometimes have SQLITE_MISUSE errors).

I originally didn't want to open the connection each time I need to query  
data (to optimize performances) but does it really make a difference?

Regards,
Gil Delavous


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to