Hello! On Sunday 11 October 2009 00:54:04 Simon Slavin wrote: > > Using transactions speeds up a long series of SELECTs because it > > eliminates the need to re-acquire a read-only file-lock for each > > individual SELECT. > > > > Since in-memory databases have no file locks, I'm not sure that is > > relevant to this specific case. > > I wasn't sure about that. It could still be slower
You can check it very easy. In transactions: ve...@veter-laptop:/tmp$ ./test.tcl 19968119 microseconds per iteration 25649514 microseconds per iteration Without transactions: ve...@veter-laptop:/tmp$ ./test.tcl 35586024 microseconds per iteration 28630785 microseconds per iteration $ cat ./test.tcl #!/usr/bin/tclsh8.5 package require sqlite3 sqlite3 db :memory: set limit 500000 db eval {create table test(id int primary key, value text)} puts [time { db transaction { for {set i 0} {$i<$limit} {incr i} { set value "value $i" db eval {insert into test (value) values ($value)} } } }] puts [time { db transaction { for {set i 0} {$i<$limit} {incr i} { set rowid [expr round(rand()*$limit)] db onecolumn {select value from test where rowid=$rowid} } } }] Best regards, Alexey Pechnikov. http://pechnikov.tel/ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users