I want to upgrade my inserts velocity and I read about modifying the journal mode. How can I do it on TCL code? Thanks!
Assuming db
is your SQLite database handle, you just issue a PRAGMA
like this:
db eval {
PRAGMA journal_mode = WAL;
}
If you care a lot about speed and not much about integrity (I have one application where this is the case) then you're probably sufficiently well served by just turning off synchronization while you're doing all the inserts.
db eval {
PRAGMA synchronous = OFF;
}
Doing this makes writing to an SQLite database about as fast as just writing directly to your own binary file, but it is only a good idea in some cases. (My case alluded to above is where the writing process is what made the database and where anything other than total success is not useful to users. It's definitely not a normal database use-case!)
Note that pragmas are per DB handle/connection.