I have a MySQL innodb database at 1.9GB, showed by following command.
SELECT table_schema "Data Base Name"
, sum( data_length + index_length ) / 1 048 576
as "Data Base Size in MB"
, sum( data_free )/ 1 048 576
as "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema ;
+--------------------+----------------------+------------------+
| Data Base Name | Data Base Size in MB | Free Space in MB |
+--------------------+----------------------+------------------+
| database_name | 1959.73437500 | 31080.00000000 |
My questions are:
Does it mean if I set the innodb_buffer_pool_size to 2GB or larger, the whole database can be loaded into memory so much fewer read from disk requests are needed?
What does the free space of 31GB mean?
If the maximum RAM can be allocated to innodb_buffer_pool_size is 1GB, is it possible to specify which tables to loaded into memory while keep others always read from disk?
Thanks in advance.
show variables like 'innodb_data_file_path'
. The free space reported is how much of the current data files is unused. In your case, you've got 2gigs of data stored in (most likely) 32gigs of InnodB data files, leaving 30gig available.consider using memcached as a cache layer to eliminate database access altogether if you need better performance.