![](https://secure.gravatar.com/avatar/f36888e058d36af01da600b1fb90c808.jpg?s=120&d=mm&r=g)
Hi,
Jan,
I think "InnoDB file space defragmentation" could use significantly more explanation.
By my understanding, delete-marked rows are in fact "physically deleted" (re-linked to the garbage record list) during purge. However, the garbage records in the list are not reclaimed unless: a. the first record in the list has enough usable space for a newly inserted records (potentially leaving some of the record's space unused); or b. the page becomes full and gets re-organized, freeing all garbage space implicitly. Of course then even in the best case the page is still "used" and not free.
This all is true.
Freeing unused file space is an entirely different problem, involving potentially relocating used pages to be more contiguous, and then reducing the free limit and then the page count for the space.
This is what I was proposing with defragmentation, either physically freeing unused pages or relocating used pages to be more contiguous, reducing the free limit and page count.
They seem to be entirely different problems and without much overlap at all. They are both potentially useful, and interesting. (Although I am not sure why to make it an external tool as opposed to internal functionality, that seems unnecessary.)
Both are useful, but you need to start from somewhere. I could use internal functionality if there is suitable syntax that can be used to do this already, I would not like to extend SQL-again. R: Jan -- -- Jan Lindström, Principal Engineer SkySQL - The MariaDB Company