How to minimize number of bytes written to disk by mysqld?

Viewed 2214

I'm using mysql server on raspberry pi (raspbian system) to store sensor readings. Each minute one record of length 20 bytes is inserted to mysql table.

But iotop command shows that mysqld process writes 200K each minute. I would like to minimize ammount of data that is written to sd card in order to extend it's durability (I've already applied fixes for preventing sd card damage, like tmpfs for logs and other hacks).

Why mysqld writes 200K bytes when only 20B of data is inserted to table? Is there ony way to minimize writes in above scenario, tune mysql server?

Interesting thing is that vmstat command does not show so much data written to disk in "io/bo" column

I use mysql server version 5.5.33-0+wheezy1 and innoDB tables.

UPDATE:

Bill's thorough answer below made me realize that using mysql server was an overkill for simple sensor logging. Eventually I migrated to sqlite. For the same table structure sqlite writes 6 times less bytes per transaction (about 30kb) than mysql, which is better for RPi sd card. I'm still working on optimization because, as I said before, I write only 20b of actual data per transaction.

2 Answers
Related