Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable MySQL comments for InnoDB with foreign keys?

For some time I noticed that MySQL would append comments to InnoDB tables that have foreign keys defined. It looks like this:

InnoDB free: 0 kB; (event_id) REFER events(event_id) ON U...

In order to display my table description correctly, I have to parse string and split it by semicolon. It is not big deal in general, however it's quite annoying to see this messages all the time in Database GUI.

I went through stackoverflow and found this question which was not very handy in my case, so I'm wandering is it possible to disable this behaviour/bug?

UPDATE: MySQL version installed on hosting provider servers is 5.0.77

like image 833
Nazariy Avatar asked Feb 05 '11 20:02

Nazariy


People also ask

How do I disable foreign key checks in MySQL?

You can disable foreign key check in MySQL by setting the system variable foreign_key_checks to 0. However, please note, after you enable foreign key checks, MySQL will not re-validate your existing data that you added after disabling foreign key check. It will only check any new additions/updates to your database.

Does InnoDB support foreign keys?

InnoDB does not currently support foreign keys for tables with user-defined partitioning. This includes both parent and child tables.

How do you ignore foreign key constraints?

To disable a foreign key constraint for INSERT and UPDATE statements. In Object Explorer, expand the table with the constraint and then expand the Keys folder. Right-click the constraint and select Modify. In the grid under Table Designer, select Enforce Foreign Key Constraint and select No from the drop-down menu.

What is enable foreign key checks?

It is permitted to drop a table with foreign keys referenced by other tables. Enabling foreign_key_checks does not trigger a scan of table data, which means that rows added to a table while foreign_key_checks is disabled are not checked for consistency when foreign_key_checks is re-enabled.


1 Answers

I found this question in MySQL official forum. It seems that MySQL engineers know the problem but aren't fixing it. http://forums.mysql.com/read.php?22,49710,49710#msg-49710

I'm not sure I'm in the position to negotiate a change in the InnoDB storage engine, however if you ask me as a user and a MySQL developer I'd say: yes, change this as soon as you can. The free space info does not belong in the table comment. .. Mike Lischke, Senior Software Engineer MySQL Developer Tools Oracle Corporation, www.oracle.com ..

-

some applications will break when we move the info from the comment to Data_free. And users will need to learn a new way to check the free space. Thus, the change can only take place in a new major version. Heikki Oracle Corp./Innobase Oy InnoDB - transactions, row level locking, and foreign keys for MySQL

like image 181
Lordalcol Avatar answered Nov 01 '22 08:11

Lordalcol