----- Original Message -----
From: "D. Richard Hipp" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 07, 2004 7:10 PM
Subject: Re: [sqlite] Is this an in-memory database too


> Yes.  As many different processes as you want can read the database
> at the same time.  Only one process at a time can write, but since
> writes usually take a millisecond or less, that is not normally a
> problem.  The writer process does its writing, then when it is done
> the other reader processes go back to doing their reading.
>
well, this is not actually as true as it should be. true, writes are fast
per se.
however, if you operate at a synchronous level of anything more than 0,
the whole operation of inserting a record,say, is quite slow, at least in
windows.

These are my findings:

with sync=none :
 everything is extremely fast, but no practical way to flush the disk file
buffer

with sync<>none
a single transaction has a largish overhead, which relates to the flushing
of the disk file. for example, the following may take hundreds of
milliseconds:

insert into foo values(somevalues)

and also,

begin
insert into foo values(somevalues)
commit

however, the following will take almost the same time :

begin
insert into foo values(somevalues)
insert into foo values(somevalues)
insert into foo values(somevalues)
insert into foo values(somevalues)
insert into foo values(somevalues)
insert into foo values(somevalues)
insert into foo values(somevalues)
commit

in other words, the time is not consumed  by the INSERTS, but by the END
(implicit or explicit). since the locks are held for the duration of the
transaction,
a reader will be blocked by a minimum time of one single flush overhead,
which is NOT a millisecond or so.

so, at least in windows, there is no such thing as a fast WRITE, unless one
chooses to sacrifice data integrity. bulk operations are fast, however,
because they can be bracketed by a transaction, which disables the
per-statement flushing.

I wish there was a way around this.

DRH, care to comment ?

PS what does the "D." stand for ?

Reply via email to