4 ms·
> it seems MariaDB does support transactions for all of this No, DDL cannot be used in a transaction in any version of MySQL or MariaDB. > I've typically reco
by evanelias 2y ago
> it seems MariaDB does support transactions for all of this
No, DDL cannot be used in a transaction in any version of MySQL or MariaDB.
> I've typically recommended PostgreSQL. It's just eliminates an entire class of common headaches and errors
That's fair, but it does create new headaches, for example the notion of an invalid index (as described in the post) simply does not exist in MySQL or MariaDB. Index creation does not block concurrent writes, and won't fail mid-stream due to a lock conflict with old row purging (equivalent to PG's vacuum). And if a DDL statement somehow does fail, e.g. due to an ill-timed host crash, it is fully cleaned up -- DDL is atomic, just not transactional.
One way to avoid the "half a migration" problem you mentioned up-thread is to use declarative schema management, which doesn't require tracking completion state of "migrations" at all: https://www.skeema.io/blog/2019/01/18/declarative/ https://www.skeema.io/blog/2019/01/18/declarative/