Re: [sqlite] multiple threads with shared cache mode
>No, it's one write transaction per table. Wierd, according to the doc : "At most one connection to a single shared cache may open a write transaction at any one time. This may co-exist with any number of read transactions" -- View this message in context: http://old.nabble.com/multiple-threads-with-shared-cache-mode-tp26500974p26502966.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] ATTACH & Shared cache
In fact I want to work on 2 different database. 1 connection (cx1) with the db1 for write operations (shared cache enabled, read uncommited) 1 connection (cx2) with the db2 for write operations (shared cache enabled, read uncommited) And another connection (or cx1) with both db1 and db2 attached to make select query with tables join. insertions via cx1 & cx2 use a big transaction for performance issue... So if I want to perform a query with the connection with the 2 db attached does the query will search data to the shared cache to have the fresh data ? >What difference does it make for you? What do you call "shared cache" >here? Two different files cannot share cache anyway because they're >different files with different pages. Or do you call caches shared if >they can use the same memory? Then cache in SQLite is always shared. >Or do you ask whether SQLite will use the same internal class and >share cache limits for both files? Then the answer is no, it won't. >Please elaborate what exactly do you want to know. >Pavel -- View this message in context: http://old.nabble.com/ATTACH---Shared-cache-tp26496094p26497496.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] ATTACH & Shared cache
Hi, With shared cache enabled, if we want to attach a database to the current connection does sqlite create a new shared cache for the new attached database or does it share the same shared cache ? Thanks -- View this message in context: http://old.nabble.com/ATTACH---Shared-cache-tp26496094p26496094.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Asynchronous I/O and shared cache
According to the documentation : "database connection in read-uncommitted mode does not attempt to obtain read-locks before reading from database tables as described above. This can lead to inconsistent query results if another database connection modifies a table while it is being read, but it also means that a read-transaction opened by a connection in read-uncommitted mode can neither block nor be blocked by any other connection." Correct me if I'm wrong but if the "shared cache" access is locked for each sqlite3_step, so it's not possible to have inconsistent query results.. and no possible "real" parallel read/write. Regards > I don't know what Dan meant by his words but AFAIK there's no mutex > making exclusive grab of shared cache by sqlite3_step() call. There is > only mutex making sqlite3_step() execution exclusive for connection > object. I meant the mutex that is a member of the BtShared struct (BtShared.mutex). Grabbed by the call to sqlite3VdbeMutexEnterArray() at the top of sqlite3VdbeExec() and not released until that function returns. Pavel is right, technically it's not grabbed by sqlite3_step(). But 99% of the time spent in sqlite3_step() will be spent in a single call to sqlite3VdbeExec(), so the effect is similar. Dan. > Pavel > > On Wed, Nov 18, 2009 at 8:40 AM, presta <harc...@gmail.com> wrote: >> >> I'm confused according to Dan Kennedy : >> >> "Each shared-cache has its own mutex. The mutex is held for the >> duration >> of each sqlite3_step() call. So the way you're defining it here, you >> can't have "real" concurrency when using shared-cache mode in any >> case. " >> >> So, it's a little bit "antagonist" to say "with shared cache they >> will be >> parallelized pretty effectively in the same file too" >> >> >> >> -- >> View this message in context: >> http://old.nabble.com/Asynchronous-I-O-and-shared-cache-tp26402983p26407922.html >> Sent from the SQLite mailing list archive at Nabble.com. >> >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- View this message in context: http://old.nabble.com/Asynchronous-I-O-and-shared-cache-tp26402983p26421364.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Asynchronous I/O and shared cache
I'm confused according to Dan Kennedy : "Each shared-cache has its own mutex. The mutex is held for the duration of each sqlite3_step() call. So the way you're defining it here, you can't have "real" concurrency when using shared-cache mode in any case. " So, it's a little bit "antagonist" to say "with shared cache they will be parallelized pretty effectively in the same file too" -- View this message in context: http://old.nabble.com/Asynchronous-I-O-and-shared-cache-tp26402983p26407922.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Asynchronous I/O and shared cache
To be more precise I would like to parallelize writes operations on different tables, so potentially in different db (files). It's why I think about using multi databases (1 by table), the shared cache system and the asynchronized I/O.. So if a shared cache is shared accross different databases, writes operation will be "serialized", so according to all reply it seems that a shared cache is create for each different db instance ?? -- View this message in context: http://old.nabble.com/Asynchronous-I-O-and-shared-cache-tp26402983p26407565.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Asynchronous I/O and shared cache
Thanks, I will try to use the shared cache with Async I/O "Each shared-cache has its own mutex"... So, does it possible to have more than one shared cache within a single process ? One shared cache by db ? -- View this message in context: http://old.nabble.com/Asynchronous-I-O-and-shared-cache-tp26402983p26405154.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Asynchronous I/O and shared cache
Hello, I'm wondering if shared cache and read uncommited isolation level with asyncronous I/O enabled is possible ? In sqlite3async.c I see a shared mutex between read and write operations, so I doubt that it is possible to have real concurrency between read and write... Regards -- View this message in context: http://old.nabble.com/Asynchronous-I-O-and-shared-cache-tp26402983p26402983.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Asynchronous I/O and shared cache
Hello, I'm wondering if shared cache and read uncommited isolation level with asyncronous I/O enabled is possible ? In sqlite3async.c I see a shared mutex between read and write operations, so I doubt that it is possible to have real concurrency between read and write... Regards -- View this message in context: http://old.nabble.com/Asynchronous-I-O-and-shared-cache-tp26402982p26402982.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users