Concurrency Week How to Delete Just Some Rows from the Really Big Table

Concurrency Week How to Delete Just Some Rows from the Really Big Table

Say you’ve got a dining table with millions or huge amounts of rows, and you also need certainly to delete some rows. Deleting ALL of them is quick and that is easy do TRUNCATE TABLE – but things have much harder if you want to delete a small percentage of them, state 5%.

It’s especially painful if you want to do archiving that is regular, like deleting the oldest 1 month of data from a dining table with ten years of information in it.

The trick is making a view that contains the very best, state, 1,000 rows that you would like to delete

Make sure that there’s an index to support your view

After which deleting from the view, maybe not the dining table

Allowing you nibble down deletes in faster, smaller chunks, all while avoiding ugly dining table hair. Continue reading “Concurrency Week How to Delete Just Some Rows from the Really Big Table”