bd96500e110b49cbb3cd949968f18be7.png

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.

解决方案Not exactly. InnoDB buffer pool are used to buffer reads and writes. if most of your access is read, most if it will be cached and fewer disks access will be needed.

could be this bug, it's not documented very well but I think data_free is the available space inside the innodb files (if you write more than this InnoDB will have to enlarge the data file(s)).

no, but InnoDB will cache the data that you access most automatically, so it should have an optimal effect anyway.

consider using memcached as a cache layer to eliminate database access altogether if you need better performance.

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐