First of all, what are the entry types that reside in ibdata1 ? Four(4) entry types:
- Table MetaData
- Table Data Pages
- Index Data Pages
- MVCC Data
Whenever an InnoDB table experiences DDL, DML, or being used in a Transaction, all four of these types of entries are either read or written. Meanwhile, if innodb_file_per_table is disabled, all these entry types live in ibdata1. If it is enabled, only the Table MetaData and the MVCC Data would reside in ibdata1 while the Table Data Pages and Index Data Pages would reside in the database subfolder as a .ibd file.
That being considered, what would happen if ibdata1 were placed in another volume and symlinked ?
For starters, how does MySQL represent a table regardless of the storage engine ? As a .frm file. Where do .frm files live ? In the datadir. What's wrong with that ?
Here is an example:
Using the default datadir of /var/lib/mysql, let's use an InnoDB table called mydb.mytable.
With innodb_file_per_table disabled, everything would sit in ibdata1 (which you are proposing to symlink and send off to another data volume). For the table mydb.mytable, this is what you would have:
- /var/lib/mysql/mydb/mytable.frm
- Everything else about the table lives in ibdata1
Picture this now: You access the table, MySQL would first hit /var/lib/mysql/mydb/mytable.frm and then hit the data and index pages in ibdata1 for mydb.mytable. This would constantly be happening with every access of mydb.mytable. This cascading back-and-forth would somehow make things a little slower and you may not get the performance you were expecting by moving ibdata1 to some other data volume. In fact, the cascading effect would now be a factor of the number of InnoDB tables multiplied by two(2).
Imagine having innodb_file_per_table enabled. Now you would have a slightly different setup:
- /var/lib/mysql/mydb/mytable.frm
- /var/lib/mysql/mydb/mytable.ibd
- MVCC data and Table MetaData would reside in ibdata1
This cascading would be a little worse because the cascading for table access would now occur among three files instead of two.
Here is one more scenario some have thought of: Instead of moving the ibdata1 to a different volume, how about enabling innodb_file_per_table and moving the .ibd files to one or more different data volumes ? The cascading effect would now be a factor of the number of InnoDB tables multiplied by three(3). Percona has expressed very good reasons for not doing this that you will find helpful.
What I have done in the past is to use something like this:
1) Each document has a logical type associated with it.
2) Set up tables for metadata for each logical type. Each row can store all metadata associated with the document.
The other approach is that of key-value-modelling which can actually be ok or not depending on what you are doing with it. In this case you have a metadata table which stores all metadata, one value per record, for all documents. This works best if you find a reasonable way to aggregate the data in result sets, and if you aren't doing complex searches across multiple metadata fields.
Best Answer
InnoDB Architecture
This first thing that comes to mind is the InnoDB Buffer Pool. It holds three things
.ibd
files.ibd
filesAny query accessing infrequent data will basically remove the working dataset from the InnoDB Buffer Pool just to load the adhoc data. To get those data back, you have two options:
OPTION 1
: Reread the data and index pages from disk. You are certainly going to experience a cache storm that will impact Server Load with Disk I/O, Memory Utilization, and possible swapping.OPTION 2
: Unload Buffer Pool Before Accessing Old Data and Reload Buffer Pool Afterwards. This is a new feature for MySQL 5.6. Apparently, it was made for occasions like this. Here are the options for loading the InnoDB Buffer Pool at Startup, Shutdown and On-Demand :EPILOGUE
OPTION 1
is something you reluctantly live with until all subsequent queries bring back your most recent working datasetOPTION 2
requires scripting adhoc reports to do the followingOPTION 2
requires upgrading to MySQL 5.6