brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: skip-extended-insert puts one row per line so database dumps diff cleanly

Database
~/tips/tip-database-mariadb-dump-skip-extended-insert

mariadb-dump --skip-extended-insert shop orders > orders.sql

Writes one INSERT per row so diff and grep show exactly which rows changed.

By default a dump packs hundreds of rows into one giant INSERT line. That restores fast, but a diff between two dumps then shows a single changed line of a few megabytes.

mariadb-dump --skip-extended-insert shop orders > orders.sql

Now every row gets its own statement:

INSERT INTO `orders` VALUES (1,'ann',10.00,'2026-01-01');
INSERT INTO `orders` VALUES (2,'bob',20.00,'2026-02-01');

Two of those files diff nicely, so you can see which rows changed between yesterday and today. It also makes grep useful, because a match is one row instead of the whole table. I like it for small tables with settings or lookup data you want to track over time, perhaps next to a schema dump in git.

For a big table it is the wrong choice. The file gets larger and a restore runs one statement per row, which is a lot slower than the packed version. Keep your normal backups on the default and use this only for dumps that you want to read or compare. To be thorough with diffs, add --skip-dump-date as well, or the last line changes on every run.

Further reading: mariadb-dump documentation

More Database tips mariadb -e 'CREATE DATABASE IF NOT EXISTS blog' mariadb-dump --no-create-info --insert-ignore shop orders > orders-rows.sql SELECT table_schema, table_name, CHECKSUM TABLE shop.orders; services: All Database tips (53) All topics

Link