Usually, database people are familiar with table fragmentation with DELETE statements. Whenever doing a huge delete, in most cases, they are always rebuilding the table to reclaim the disk space. But, are you thinking only DELETEs can cause table fragmentation? (Answer: NO).
In this blog post, I am going to explain how table fragmentation is happening with the INSERT statement.
Before going into the topic, we need to know that with MySQL, there are two kinds of fragmentation:
- Fragmentation where some of the InnoDB pages are completely free inside the table.
- Fragmentation where some of the InnoDB pages are not completely filled (the page has some free space).
There are three major cases of table fragmentation with INSERTs :
- INSERT with ROLLBACK
- Failed INSERT statement
- Fragmentation with page-splits
…
[Read more]