Removing MYSQL mass from 80 tables

I have a 50 GB mysql database (80 tables) that I need to remove from it. I have a lookup table containing a list if product identifiers that need to be removed from other tables.

Now the rest of the tables can be 2 GB each, contain items that need to be deleted.

  • My question is: since this is not a small database, what is the safest way to delete data in one frame in order to avoid problems?

  • What is the best method to verify that all data has been deleted?

+5
source share
5 answers

Thirler , . .
, . ,

delete from a where id in (select id from keys)  

LIMIT DELETE. . , . :

create function check_consistency() returns boolean
begin
   return not exists(select * from child where id not in (select id from parent) ) 
       and not exists(select * from child2 where id not in (select id from parent) );
   -- and so on  
end
0

, . . mysql ( , , InnoDB) ( ). , (, ), , (, product_storage). , 100% - . . , , , , ( )

100% . , , , , sql-, , .

+1

, , . burnall , , .

, , , , , , .

+1

, . 1 MySQL. , , InnoDB. myisam InnoDB, . - :

START TRANSACTION;

...Perform changes...
...Control changes...

COMMIT;
...or...
ROLLBACK;

?

PostgreSQL > 250 . , . , , / .

//

+1
0

All Articles