Yes, this could be an option. Although as you pointed it yourself including rand() and doing it on all statements in code here and there is not very convenient.
I thought myself about turning synchronous on and changing somehow sqlite3_io_methods functions where xSync will do its job once in every N calls. But it looks ugly for me too. So I thought maybe someone can come up with better idea... Pavel On Wed, Apr 22, 2009 at 4:58 PM, Doug Currie <doug.cur...@gmail.com> wrote: > > On Apr 22, 2009, at 4:38 PM, Pavel Ivanov wrote: > >> I've tried to set pragma synchronous = on (it's off by default for >> me), but it makes application to work 5 times slower which is not >> acceptable for me. I would be happy if there was some solution in >> between that, i.e. for example just a bit slower operation on every >> pwrite but without 8 seconds-peaks. > > Perhaps you can occasionally wrap a transaction with: > PRAGMA synchronous = NORMAL; > < do the transaction > > PRAGMA synchronous = OFF; > > which would flush OS allocated database cache buffers; do this one out > of N transactions. If you have threads performing transactions that > are not otherwise communicating, you base this decision on a random > number [rand() % N == 1]. Tune N to achieve the maximum pwrite time > you need. > > Caveat: I have never tried this; I don't use PRAGMA synchronous = OFF. > > e > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users