Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2016 September MySQL: The Truth about InnoDB File Per Table Tablespaces

MySQL: The Truth about InnoDB File Per Table Tablespaces

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

In this post, I am going to discuss MySQL InnoDB File-Per-Table tablespaces.
What are the advantages and disadvantages? How to enable and disable it?

By default, The InnoDB stores tables and indexes into the system tablespace. If we want to create separate .idb and .frm file for each table, we should enable innodb_file_per_table.

How to Enable and Disable Innodb_file_per_table?

To Enable:
Add below line into [mysqld] section of my.cnf file and restart the MySQL Server. It will create two separate file for each table, .idb file for data and .frm file for table definition.

1
2
[mysqld]
innodb_file_per_table=1

1
2
-- We can also run this command and restart MySQL Server.
SET GLOBAL innodb_file_per_table=1;

To Disable:
Simply, you can remove innodb_file_per_table line from my.cnf and restart the server. Now newly created table stores into common tablespace (ibdata1).

Advantages to enable innodb_file_per_table:

  • The Truncate Table operation runs faster when we have separate.idb file.
  • We can reclaim disk space by truncating and dropping a single table. On the other side, with the single table space we can use this free space only for new InnoDB data.
  • We can easily run OPTIMIZE TABLE on individual Table files.
  • We can easily store and move individual table.
  • We can use features like compressed and dynamic row formats.
  • We can quickly perform backup and restore of individual tables.

Disadvantages to enable innodb_file_per_table:

  • The management of each different file is very difficult and time taking exercise.
  • Each different file has unused space so we require to perform OPTIMIZE TABLE on each individual file.
  • Mysqld has to open file handler per table, which may reduce the performance of MySQL Server.
  • For every action of each file buffer pool is scanned, which reduce the performance of MySQL Server.
Sep 21, 2016Anvesh Patel
MySQL: Why InnoDB Engine stores all databases in one file (ibdata1)?MySQL: How to import XML File Data into a Table?
Anvesh Patel
Anvesh Patel

Database Engineer

September 21, 2016 MySQLAnvesh Patel, database, database research and development, dbrnd, innodb, innodb_file_per_table, MySQL, MySQL Command, MySQL Database Administrator, MySQL Database Designing, MySQL Database Programming, MySQL Error, MySQL Performance Tunning, MySQL Query, MySQL Tips and Tricks
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... } – May 27, 12:43 PM
  • Anvesh Patel { Great... } – May 27, 12:41 PM
  • Anvesh Patel { Great... } – May 27, 12:39 PM
  • Anvesh Patel { Great... } – May 27, 12:36 PM
  • Anvesh Patel { Great... } – May 27, 12:28 PM
  • Anvesh Patel { Great... } – May 27, 12:27 PM
  • Anvesh Patel { Great... } – May 27, 12:16 PM
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....