Laszlo Elteto wrote:
For this particular application it would NOT be a problem to lose like 2-5
seconds of transactions. I wonder if it is possible to tell SQLite to "hold
off" the transactions, ACCUMMULATE them until a certain time (or if cache
memory is exhausted - which is not yet the case as we have a modest
database), then make a BIG COMMIT (ie. all previous transactions committed
or none). That way it's still transactional (ie. no currupted database - I
really don't want to use sync = OFF) but the I/O performance wouldnt slow
down serving requests.

Laszlo,

You should be able to do this yourself without changing the SQLite source code.

You can create two functions to wrap the begin and end transaction operations. You can have your begin function check for an existing transaction and only open a new one if there isn't one open yet. It records the start time for the transaction. The close function counts down until all open transactions are closed. If the current time is more than your limit after the start time, it actually closes the transaction and flushes the changes to disk. Pseudo code is below:

begin_transaction
   if transaction open
      increment open count
   else
      open transaction
      set transaction open to true
      set transaction start time
      set open count to 1

end_transaction
   decrement open count
   if open count = 0
      if now - transaction start time > 5 seconds
         close transaction
         set transaction open to false

HTH
Dennis Cote

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

Reply via email to