A Swiss Geek previously in Singapore, now in Portugal

MySQL

MySQL: deleting a huge amount of rows

One of our MySQL tables has started to grow out of control with more than 1 billion rows (that’s 109). The table is a typical “Rails Active-Record table” with id as primary key (auto increment), created_at, updated_at and a few columns for the business data. The table has multiple indexes on various columns, some of them having a cardinality in the millions. created_at and status don’t have an index. The majority of results from Google, involved peoples with millions of rows and deleting them in batches of 1000.

Read More…