On 3/28/18, lutz.reinha...@elektrobit.com <lutz.reinha...@elektrobit.com> wrote: > Hi Sqlite Users, > > The goal is that an eMMC flash chip survives 15 years. And as we all know > flash memory only supports a limited amount writes per cell before it fails. > So if I get data to store from the user I would like to estimate before > putting it into the database how much pages SQLite is going to write/modify > to the flash. Is there any API, which can provide me such an estimation? > > I will also use a VFS shim to get the real number of written bytes > afterwards.
There is no such API that I can think of. I think you will need to write a custom VFS shim to get that information. I suspect https://www.sqlite.org/src/file/ext/misc/vfsstat.c is sufficient for this task. The best way I know of to minimize flash wear is to switch to the F2FS filesystem and use PRAGMA journal_mode=DELETE. If you cannot use the F2FS filesystem, then PRAGMA journal_mode=WAL with PRAGMA synchronous=NORMAL is probably your best bet. -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users