On 2005-05-29T18:20:33-0400, John Ruttenberg wrote:
> I timed it.  It takes just under a second for 1M calls to rand().  This didn't
> change over thousands of repetitions.

Ok.

> > You mean an update?  How do you select a random row?  In particular is
> > that a constant (in time) operation?
> 
> No, sorry.  I meant a *delete* of an existing row.  The choice takes almost no
> time.

Is the ratio of inserts to deletes constant (i.e. about 1)?  If it takes
very little time to find a record to delete, doing that 0.5M times or on
every 2nd operation on average would make a difference.  Does the first
batch of inserts take the same amount of time as the nth batch? What
about batches deletes?

I have not looked at the source, but sqlite uses btrees, right?  Insert
and delete performance takes (some) logarithmic time based on number of
slots in use.  Deleted records are kept on a free list, so
"fragmentation" of the data structure account for some of this.  Growing
data set may kill your cache hit ratio (both in sqlite and os).  Not
sure how the free list works, but it may grow in length due to the
random size of your record.

Does `pragma auto_vacuum = 1` make any difference to the growth?  Or
running the vaccum command between every 1M iteration.

So no answers, just more questions :-)


/Allan

Attachment: signature.asc
Description: Digital signature

Reply via email to