Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does MySQL add a comment to InnoDB tables?

Tags:

mysql

innodb

When using phpMyAdmin or the MySQL GUI Tools, whenever I create an InnoDB table, it adds a comment to the table like this:

InnoDB free: 9216 kB

What does this mean? What's it used for?

like image 923
nickf Avatar asked Dec 16 '08 04:12

nickf


People also ask

What is InnoDB corruption?

InnoDB corruption. Most InnoDB corruptions are hardware-related. Corrupted page writes can be caused by power failures or bad memory. The issue also can be caused by using network-attached storage (NAS) and allocating InnoDB databases on it.

What is InnoDB tables in MySQL?

InnoDB is a general-purpose storage engine that balances high reliability and high performance. In MySQL 5.6, InnoDB is the default MySQL storage engine. Unless you have configured a different default storage engine, issuing a CREATE TABLE statement without an ENGINE clause creates an InnoDB table.

Can I change MyISAM to InnoDB?

You can convert MyISAM to InnoDB fairly easily. This example is below is using the wp_comments table. Simply run the ALTER command to convert it to InnoDB storage engine. Note: We always recommend backing up your MySQL database before running any operations on it.

Is engine InnoDB necessary?

Always. Unless you need to use MySQL's full-text search or InnoDB is disabled in your shared webhost.


1 Answers

InnoDB stores many tables per file. Inside that InnoDB data file, there can be free space:

  • When you drop a table or index, delete rows, or replace rows with smaller ones (e.g., shorter TEXT)
  • The file is grown n MB at a time (configured in my.cnf)

The comment is just telling you how much free space is in your InnoDB datafile(s). When that approaches 0, InnoDB will expand the data file.

I believe the default allocation block is 10MB, so that's probably why you have almost 10MB free.

like image 187
derobert Avatar answered Oct 30 '22 11:10

derobert