On 12/3/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> "P Kishor" <[EMAIL PROTECTED]> wrote:
> > I get 1000+ inserts a second for a random 100 byte string
> > insert (
>
> I get 50000+ inserts/sec on my Linux box.

turned off AutoCommit, turned off rand string generation, and lookee
what I get...

200,000 inserts in half a second. If my math is not wrong, that works
out to more than 360 thousand inserts per sec on the same laptop with
a 5400 rpm 2.5" disk. Of course, I batched up the commit at the end.
Including the COMMIT, the speed dropped down to almost 67,000 inserts
per sec.

sqlite> select count(*) from foo;
200001
sqlite>


All of the below comes from a wiser man than I.

>
> Insert speed is not the issue.  It is COMMIT speed.  At
> each commit, SQLite waits until all data is on oxide before
> continuing.  That will typically take at least two rotations
> of the disk platter, or about 17 millisecond, depending on
> your disk drive.  Waiting for data to get to oxide is
> part of being ACID.  You can set:
>
>    PRAGMA synchronous=OFF;
>
> and your COMMITs will go *much* faster because it will no
> longer wait on the disk drive.  But if you lose
> power in the middle of a commit, you might corrupt your
> database file.
>
> Note that there is an implied BEGIN...COMMIT around every
> INSERT statement if you do not explicitly start a transaction
> using your own BEGIN.
>
> --
> D. Richard Hipp <[EMAIL PROTECTED]>
>

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to