Sample Header Ad - 728x90

Why Optimize Table does not shrink table size?

3 votes
3 answers
2320 views
I implemented this solution for big database, only keep data for 14 days (remove data daily based on date). When I run optimize TABLE table1; The size supposes to decrease but in my case, it increases. /etc/my.cnf contains:
innodb_file_per_table
innodb_flush_method=O_DIRECT
innodb_log_file_size=1G
innodb_buffer_pool_size=4G
ll --block-size=GB /var/lib/mysql/mydb/ print:
-rw-r-----. 1 mysql mysql  17GB Nov 20 15:45 table1.ibd
-rw-r-----. 1 mysql mysql   5GB Nov 20 15:30 table2.ibd
-rw-r-----. 1 mysql mysql 181GB Nov 20 15:29 table3.ibd
Asked by N_Z (248 rep)
Nov 20, 2022, 01:05 PM
Last activity: Dec 16, 2022, 08:00 PM