On 8 Jul 2009, at 9:28pm, Rizzuto, Raymond wrote:

> If I remove the locking_mode=exclusive, I don't get those errors.
>
> I'd appreciate any advice on how I can get the best performance  
> using multiple threads in my application, given that:
>
>
> 1.  I need maximum performance.

Spend at least five grand on a fast water-cooled box.  Use a version  
of Unix/Linux compiled without support for anything you don't need,  
like printing.  Create your database file on a RAM disk.  Write your  
application as a command-line app, and don't run the GUI.

> That is also why I need multiple threads

May not help if they're all constantly accessing the database.  In  
fact contention for access can slow the process down: you have seven  
threads, five of which are perpetually blocked.  There's no one-size- 
fits-all solution to fast database access, it depends on the patterns  
of when data is available for writing, and how important the order the  
data was available is when you read.  Sometimes you pile up all your  
data to be written into a text file, and another process (on a  
different computer ?!) works through the text file and does the writing.

> 2.  All threads need to write to the same db
> 3.  No other application needs access to the db
> 4.  I don't care about durability, just fast insert times since  
> reads are much less frequent.

Use BEGIN TRANSACTION and COMMIT properly.  This may be more important  
than multi-threading.  It has a huge result.

If reads are /really/ rare, it might be worth removing all indices on  
your database, and only creating an index just before you need to  
read, or even just executing the SELECT without any indices.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to