Open bbrala opened 8 months ago
Thanks for sharing this procedure. For deletes, the library proxies the calls to the original Laravel Schema::drop method. Is there a reason this would not work for your use-case?
I would be cautious when running DELETE FROM
when replication is enabled, as that will increase the size of the bin-log
and put pressure on the replicas.
It's a percona xtradb cluster, it will lock the database when doing ddl queries. A drop of a large db or table will mean locking is long and will stop all other write queries until done.
Using this you first delete de data with small intervals then drop when schemas are empty l which is quick.
Percona xtradb is not really replication but it runs everything writing on both servers pretty much. Great for consistency but requires using as little (or light) ddl queries as possible.
We've been using the following 'script' to drop large databses (on any really) on our cluster. We are planning to start to use your package for our Laravel apps since this would've saved us some downtime in the last few years ;)
But i noticed you cannot drop tables, perhaps our procedure could help? It doesn't clean itself up right now since we only use it for full databases, so it does that anyways. Also you'd need a user that can make procedures.
But for what its worth: