patternsqlMinor
TokuDB optimize table does not reclaim disk space
Viewed 0 times
spacediskreclaimoptimizedoestokudbnottable
Problem
Was running an
I would expect the optimization to reclaim a space.
What's happening?
After the optimization finished MySQL CPU utilization 2-3 times higher than it used to be with load average 18-20 on 24 core machine. CPU and load average went down slightly after few hours but still higher than usual. Any had similar experience?
Thanks.
optimize table command against one of my tables about 11Gig in size, surprisingly used disk space grew by 2Gig immediately after optimization process finished.I would expect the optimization to reclaim a space.
What's happening?
After the optimization finished MySQL CPU utilization 2-3 times higher than it used to be with load average 18-20 on 24 core machine. CPU and load average went down slightly after few hours but still higher than usual. Any had similar experience?
Thanks.
Solution
I've had the same experience. The solution is to rebuild the table via this command:
Replace
With InnoDB an
ALTER TABLE my_table ENGINE=TokuDB ROW_FORMAT=TOKUDB_SMALL;Replace
TOKUDB_SMALL with your favourite compression algorithm.With InnoDB an
OPTIMIZE TABLE command simply does a trivial ALTER. But in TokuDB it does not, and tablespace is not reclaimed. By forcing an ALTER with ENGINE=TOKUDB you're taking this outside TokuDB's hands, and let the MySQL server tell TokuDB to create a (really) new table.Code Snippets
ALTER TABLE my_table ENGINE=TokuDB ROW_FORMAT=TOKUDB_SMALL;Context
StackExchange Database Administrators Q#48190, answer score: 3
Revisions (0)
No revisions yet.