Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A company I work for runs MySQL on an IoT base station product (Beaglebone-like hardware). Tables seems to corrupt every so often, which typically are repairable with a "mysqlcheck --auto-repair" which they have as part of the boot sequence, but not always. These corruptions seem to be due to bad batteries or the field team holding down the power button too long.

Would sqlite be less prone to table corruption?



I think yes - If you configured something like:

  PRAGMA journal_mode=WAL;
  PRAGMA synchronous=NORMAL;
This should be very safe & still reasonably fast.

See: https://www.sqlite.org/pragma.html#pragma_synchronous and https://www.sqlite.org/wal.html


You should take a look at your mysql settings e.g. `innodb_flush_log_at_trx_commit` but yeah mysql isn't really built for frequent sudden shutdowns.


I run about 100 computers that regularly receive power cuts and have not have databases go corrupt. However we also write to the database every minute or so, all data is packed into compressed chunks that contain a minute of data.


problem is in application layer and mysql settings.

you can try to switch from myisam engine to innodb engine, tune innodb settings, write inserts in batches, rather than continuously, and wrap insert into transaction




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: