Skip navigation links
Articles
Differences Between innodb_data_file_path and innodb_file_per_table
Add to My Link Library +1 Vote Up -0Vote Down
Recently, a customer wondered if they should start using the "innodb_file_per_table" option, or if they should continue to use the large InnoDB tablespace files created by the "innodb_data_file_path" option in the "my.cnf" option file.Many people still use the older "innodb_data_file_path" option because it is the default for MySQL server. So, what are the benefits of using "innodb_file_per_table" instead?The "innodb_file_per_table" makes for easier-to-manage files. With this option each InnoDB table has its own data and index file under the database directory. As an example, if you had table "foo" located in database "xyz" the InnoDB data file for table "foo" would be "/var/lib/mysql/data/xyz/foo.idb". Each table would have its own idb table in the appropriate database directory. This is in contrast to using the "innodb_data_file_path" option with (typically) one large file in the root of your data directory. For example, it might be "/var/lib/mysql/data/ibdata1.idb". All table data and indexes would be stored in this one file, and it can be very large  and unwieldy. I don't recall the largest ibdata file I have seen, but what do you do if you have a 100 gig InnoDB tablespace file? It can, and does, happen. The file contains what amounts to all the data of all your databases on the server.


Report this link: