OH:
“And now let’s quickly push 2 billion rows into this database VM.”
That is best done in YOLO mode. This is a mode of operation for a database that minimizes disk writes in favor of batched bulk writes.
It is not ACID, so if anything goes wrong during the load, the instance is lost. That is why it is called YOLO mode.
You are supposed to do this on a spare replica and not the production primary. If you are not having at least one more replica than needed in your MySQL deployment, I consider your setup defective.
set global innodb_flush_log_at_trx_commit = 2;
gives up ACID commits: On COMMIT, …
[Read more]