how many records can be deleted using a single transaction in mysql innodb -


i wanted delete old records 10 related tables every 6 months using primary keys , foreignkeys. planning in single transaction block, because in case of failure have rollback changes. queries somethign this

delete parent_table parent_id in (1, 2, 3,etc); delete child_table1 parent_id in (1, 2, 3,etc); 

the records delete around 1million. safe delete these in single transaction? how performanace?


edit

to more clear on question. detail execution plan

i first retreiving primary keys of records parent table has deleted , store temporary table start transaciton delete child_one parent_id in (select * temp_id_table); delete child_two parent_id in (select * temp_id_table); delete parent_table parent_id in (select * temp_id_table); commit; 

rollback on failure.

given can have around million records delete these tables, safe put inside single transaction block?

you can succeed. not wise. random (eg, network glitch) come along cause huge transaction abort. might blocking other activity long time. etc.

are "old" records older date x? if so, much more efficient make use of partitioning dropping old rows. can discuss details. oops, have foreign keys, incompatible partitioning. tables have fks?

why wait 6 months before doing delete? 6k rows day would have same effect , less invasive , risky.

in ( select ... ) 

has terrible performance, use join instead.

if of tables normalizations, why bother deleting them?

would work delete 100 ids per transaction? safer , less invasive.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -