> Using three tables (e.g. test.sh 111 112 113), the first command takes > 13m3s, the second command takes 12m45s. I am wondering if there is any > magic to make the second script finish in 5 minutes by executing the > query in parallel ...
Try to execute "pragma cache_size = 1000000" before executing select. It should be executed in the same sqlite3 run to have any effect, so your argument to sqlite3 should look like "pragma cache_size = 1000000; SELECT COUNT(*) FROM table_$arg;". I think disk I/O kills your performance. iostat could prove you that. Pavel On Sat, Oct 22, 2011 at 5:11 PM, Bo Peng <ben....@gmail.com> wrote: >> >> Multithreaded mode allows SQLite to be accessed via multiple threads as long >> as threads don't shared connection handles. This is the what's sometimes >> called the apartment model of multithreading. > > Thank you very much for your quick reply. > > Is there a way to enable multi-thread mode from command line? Before > changing the source code of my program, I would like to see the effect > of multi-threading from command line. More specifically, I have two > scripts: > > #!/bin/bash > for arg in $* > do > echo "Handling " $arg > sqlite3 esp.DB "SELECT COUNT(*) FROM table_$arg;" > done > > and > > #!/bin/bash > for arg in $* > do > echo "Handling " $arg > sqlite3 esp.DB "SELECT COUNT(*) FROM table_$arg;" & > done > wait > > Using three tables (e.g. test.sh 111 112 113), the first command takes > 13m3s, the second command takes 12m45s. I am wondering if there is any > magic to make the second script finish in 5 minutes by executing the > query in parallel ... > > Bo > _______________________________________________ > 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