James Gregurich wrote:
> 
> suppose I create a temporary db file on disk. Each task ( a thread)  
> opens a connection to the temp file and attaches an in-memory db to  
> it. 

You will have to open the memory database and attach the db file since 
SQLite can't attach to a memory database.

I would operate it in much the same fashion as I described before, with 
the memory database used as the batch database, and the file database is 
the main table storage. Attach to the file, perform the update 
transaction, and then detach the file.

Readers would read open and read from the main database file.

Why have you proposed to use a temporary database file? Can this data be 
destroyed between executions?

> 
> Will such a design give me full concurrency on my writer tasks until  
> they are ready to flush their results to the disk file? As I  
> understand it, the attached db won't be locked by reading done on the  
> disk file.
> 

The way I have suggested, the readers only open the database file. They 
can read as long as no update is in progress. The updates will be 
batched into the independent memory database. During an update the 
database file will be locked, so readers will have to wait.

Dennis Cote


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

Reply via email to