Using a test script, the average time to complete an insert is a few ms. But about 3% of the time, the insert takes between 0.5 and 3 seconds to complete. If I run the same query 1000 times about 970 finish in under 10ms, while 30 take over 500ms.
I'm running a fairly recent build of Raspbian from a few months ago and SQLite 3.8.4.
The process doing the inserts jumps from about 5% CPU usage to 10% when the slow inserts happen, but otherwise the CPU usage is normal.
How can I find out what's going on here, how would I know if SQLite is waiting on the OS to write, or if it's waiting to acquire a lock, or something else?
Edit: Here is the table schema
create table n (id INTEGER PRIMARY KEY,f TEXT,l TEXT);
And Here is the query I'm running
insert into n (f,l) values ('john','smith');