[yunqa.de] Re: DISQLite & multithread

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Thu, 15 Mar 2012 07:24:51 +0100

On 14.03.2012 22:12, Alex Vulpe wrote:

> I have created a simple application with several threads. Each
> thread saves data in it's own DB.

Does all threads write to their own, separate database files or to
different database handles of the same file?

> At least for 1 & 2 threads timings should be the same, since I have
> 2 cores.

If all threads write to the same file, writes must be synchronized.
SQLite only allows a single writer at a time. This would explain the
bottleneck you are experiencing.

SQLite threading and locking is described in detail in the DISQLite3.chm
help:

- SQLite3 Documentation -> Thread Safety
- SQLite3 Documentation -> Atomic Commit
- SQLite3 Documentation -> Atomic Commit -> Locking ...

Running in WAL mode could improve performance:

- SQLite3 Documentation -> Write Ahead Logging

If you send your sources, I'd be interested to take a look.

Ralf
_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: