Browsed by
Category: SQL

Truncate Two Tables at the Same Time in MariaDB/MySQL

Truncate Two Tables at the Same Time in MariaDB/MySQL

Sometimes the tables I use for caching results on a tide calculation site I run mess up, now if I clear them one at a time I may have entires out of sync if requests come in during the truncation. Solution; START TRANSACTION; TRUNCATE TABLE `tides`; TRUNCATE TABLE `tideyears`; COMMIT;