Prepend text to mysqldump output at dump creation time
1
vote
1
answer
54
views
I am suffering from slow mysqldump/mariadb-dump.
I found that disabling
autocommit, unique_checks and foreign_key_checks
boost import performance.
I do that by prepending dump.sql
with
SET autocommit=0;SET unique_checks=0;SET foreign_key_checks=0;
and by appending
COMMIT;SET unique_checks=1;SET foreign_key_checks=1;
to the end of it.
Append is trivial, but when prepending I need to make a compromise between time or space consumed.
Prepending with
sed -i '0,/^/s//SET autocommit=0;SET unique_checks=0;SET foreign_key_checks=0;/' dump.sql
can take a lot of time for large dumps, but it creates a single file.
cat new-dump.sql"
Is fast, but it creates another dump file and is therefore using a lot of space (even though it is just temporary)
Is it possible to instruct mysqldump/maridb-dump
to prepend and append a custom text to the dump when it is creating it?
Asked by sanjihan
(285 rep)
Sep 14, 2024, 11:40 AM
Last activity: Sep 16, 2024, 08:31 AM
Last activity: Sep 16, 2024, 08:31 AM