My mistake, "PRAGMA lock_status" is only a valid command if you compile with -DSQLITE_DEBUG. And you're also right that your unused databases are being locked because you are using "BEGIN EXCLUSIVE". See here:
d...@computer2:~/work/experimental/bld$ ./sqlite3 abc SQLite version 3.6.10 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table t1(a, b, c); sqlite> attach 'def' AS def; sqlite> create table def.def(d, e, f); sqlite> begin; sqlite> insert into def values(1, 2, 3); sqlite> pragma lock_status; main|unlocked temp|closed def|reserved sqlite> commit; sqlite> begin exclusive; sqlite> insert into def values(1, 2, 3); sqlite> pragma lock_status; main|exclusive temp|closed def|exclusive sqlite> commit; sqlite> begin exclusive; sqlite> pragma lock_status; main|exclusive temp|closed def|exclusive sqlite> commit; Dan. On Jan 30, 2009, at 1:54 AM, Chris Eich wrote: > I can't get it this (undocumented <http://www.sqlite.org/pragma.html>) > pragma to do anything for me: > > $ sqlite3 db/emu.db > SQLite version 3.6.3 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> attach 'db/binned-eich.db' as binned; > sqlite> begin exclusive; > sqlite> pragma lock_status; > sqlite> select complete,count(*) from binned.device_perf_interval > group by > complete; > 0|34 > 1|145399 > sqlite> pragma lock_status; > sqlite> update binned.device_perf_interval set complete=2 where > complete=1; > sqlite> pragma lock_status; > sqlite> > [1]+ Stopped sqlite3 db/emu.db > $ ls -lc db/{emu,binned-eich}.db* > -rw-r--r-- 1 ceich ceich 16400384 Jan 29 10:47 db/binned-eich.db > -rw-r--r-- 1 ceich ceich 9379912 Jan 29 10:47 db/binned-eich.db- > journal > -rw-r--r-- 1 ceich ceich 77824 Dec 24 14:56 db/emu.db > -rw-r--r-- 1 ceich ceich 512 Jan 29 10:46 db/emu.db-journal > > But I did notice my code was doing a BEGIN EXCLUSIVE. Would this > cause an > unmodified database to be locked anyway? > > Chris > > On Thu, Jan 29, 2009 at 2:02 AM, Dan <danielk1...@gmail.com> wrote: > >> >> On Jan 29, 2009, at 3:13 AM, Chris Eich wrote: >> >>> I have read http://sqlite.org/atomiccommit.html which seems to imply >>> that >>> all db files in a transaction are locked at the same level as the >>> transaction progresses (i.e. all Reserved, then all Exclusive, ...). >>> This >>> makes sense when all the files are being changed, but I have a use >>> case >>> where I am only modifying one of the attached databases and would >>> like to >>> leave the main database unlocked. >> >> That should happen automatically. >> >> You can use "PRAGMA lock_status" to query the locks held on each >> file at any time. >> >> Dan. >> >> _______________________________________________ >> 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