Re: [sqlite] Threading issues in SQLite

2007-08-11 Thread Jiri Hajek
After several experiments and tests, I ended up using one SQLite
connection in several threads. This certainly doesn't currently work
in SQLite natively, but if you properly use some locking mechanism
(CriticalSections in my case), it works fine.

Jiri

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



Re: [sqlite] Threading issues in SQLite

2007-08-10 Thread John Stanton
You might find that using one thread and accessing the four data sets 
sequentially yields you a better result.  You will use the one Sqlite 
cache and get some benefit from not creating and detroying multiple 
caches and connections.


Bharath Booshan L wrote:

Hello All,

 I am using SQLite in one my application and I require to retrieve around
4-5 sets of information simultaneously. I have opted to run the queries in
separate threads which seems obvious choice here.

 However, I came to know from one of the documents in sqlite.org that single
connection cannot be used simultaneously across threads.

 So I would like to hear any suggestions regarding the best wary to open &
manage multiple connections i.e.

a) Is it efficient to create new connections in separate thread each time
when the query needs to be executed? ( Here I am worried about the time
taken to open connection )

b) Is it efficient to create the number of connections required, in a single
thread and use it in different threads? ( although a connection will not be
used simultaneously and this will eliminate the effort to create different
connections but we need to ensure that a connection is used simultaneously
in different threads)

Looking forward to your suggestions,

Bharath Booshan L   




---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.



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




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



Re: [sqlite] Threading issues in SQLite

2007-08-10 Thread Bharath Booshan L
Hi Dan,

 Thanks for your suggestion.

> If you have any choice in the matter, don't use threads. Run all 5
> queries from the same thread. You can either run them sequentially,

Running sequentially might trouble me as I have to update more sets of
information at a cause of single event.
 
> or sqlite3_prepare() all 5 and then round-robin calls to sqlite3_step().
I have look into this. However, could you please let me know the overhead in
managing multiple connections? Does it create any impact on my application's
performance? 

On 8/10/07 11:41 AM, "Dan Kennedy" <[EMAIL PROTECTED]> wrote:

> On Fri, 2007-08-10 at 11:25 +0530, Bharath Booshan L wrote:
>> Hello All,
>> 
>>  I am using SQLite in one my application and I require to retrieve around
>> 4-5 sets of information simultaneously. I have opted to run the queries in
>> separate threads which seems obvious choice here.
>> 
>>  However, I came to know from one of the documents in sqlite.org that single
>> connection cannot be used simultaneously across threads.
>> 
>>  So I would like to hear any suggestions regarding the best wary to open &
>> manage multiple connections i.e.
>> 
>> a) Is it efficient to create new connections in separate thread each time
>> when the query needs to be executed? ( Here I am worried about the time
>> taken to open connection )
>> 
>> b) Is it efficient to create the number of connections required, in a single
>> thread and use it in different threads? ( although a connection will not be
>> used simultaneously and this will eliminate the effort to create different
>> connections but we need to ensure that a connection is used simultaneously
>> in different threads)
>> 
>> Looking forward to your suggestions,

 



---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.



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



Re: [sqlite] Threading issues in SQLite

2007-08-10 Thread Dan Kennedy
On Fri, 2007-08-10 at 11:25 +0530, Bharath Booshan L wrote:
> Hello All,
> 
>  I am using SQLite in one my application and I require to retrieve around
> 4-5 sets of information simultaneously. I have opted to run the queries in
> separate threads which seems obvious choice here.
> 
>  However, I came to know from one of the documents in sqlite.org that single
> connection cannot be used simultaneously across threads.
> 
>  So I would like to hear any suggestions regarding the best wary to open &
> manage multiple connections i.e.
> 
> a) Is it efficient to create new connections in separate thread each time
> when the query needs to be executed? ( Here I am worried about the time
> taken to open connection )
> 
> b) Is it efficient to create the number of connections required, in a single
> thread and use it in different threads? ( although a connection will not be
> used simultaneously and this will eliminate the effort to create different
> connections but we need to ensure that a connection is used simultaneously
> in different threads)
> 
> Looking forward to your suggestions,

If you have any choice in the matter, don't use threads. Run all 5 
queries from the same thread. You can either run them sequentially,
or sqlite3_prepare() all 5 and then round-robin calls to sqlite3_step().

Either way, things will be more efficient. For you and the application.
Hey, you asked for suggestions. :)

Dan.




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



[sqlite] Threading issues in SQLite

2007-08-09 Thread Bharath Booshan L
Hello All,

 I am using SQLite in one my application and I require to retrieve around
4-5 sets of information simultaneously. I have opted to run the queries in
separate threads which seems obvious choice here.

 However, I came to know from one of the documents in sqlite.org that single
connection cannot be used simultaneously across threads.

 So I would like to hear any suggestions regarding the best wary to open &
manage multiple connections i.e.

a) Is it efficient to create new connections in separate thread each time
when the query needs to be executed? ( Here I am worried about the time
taken to open connection )

b) Is it efficient to create the number of connections required, in a single
thread and use it in different threads? ( although a connection will not be
used simultaneously and this will eliminate the effort to create different
connections but we need to ensure that a connection is used simultaneously
in different threads)

Looking forward to your suggestions,

Bharath Booshan L   



---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.



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