Use WAL mode. Set PRAGMA synchronous=NORMAL. Do transactions that last 2 minutes each, starting a new transaction after each COMMIT. Run checkpoints in a background thread.
On Mon, Aug 30, 2010 at 6:29 AM, Pankaj Chawla <pankaj...@gmail.com> wrote: > Hi > > I have a Sqlite db on an embedded device on which there are > inserts happening at a rate of 1 insert every 3 seconds. That > being the case if Sqlite does file close/sync every 3 seconds > it is going to wear off the NAND in no time. I tried to instead > put 2 mins worth of inserts inside a transaction/commit block so > that now data only gets committed every 2 mins. What I observe > though is that now a journal file gets created during the time > transaction/commit block is active and I would assume now all > my 3 second updates are going into the journal file. If that is true it > means I am still writing to the NAND every 3 seconds through the > journal file even though the main DB is only getting synced > with the journal every 2 mins. > > Is this understanding correct? If yes, is there a way to actually > reduce the number of writes happening to the NAND flash such > that I can save it from quick wear out? If no, how is the writes > to the main DB different from the writes to the journal? > > Thanks > Pankaj > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users