简体   繁体   中英

MySQL: How to keep entire myisam table in memory?

I have a lot of RAM (1 gb) on my server, and I have a table (100 mb) that I would like to increase the speed of. Is it possible to keep the entire table in memory (while keeping it MYISAM)? Would this make things faster (I already have the proper indexes).

Thanks

A better suggestion will be increase query cache size, let mysql do the internal optimization

more details - http://dev.mysql.com/doc/refman/5.5/en/query-cache.html

If you have lots of memory in the machine and you use it for MySQL primarily, the OS should take care of that. With MyISAM the idea is to let the filesystem keep the pages in its cache that are mostly needed. With lots of RAM, chances increase that your table will not hit the disk very much anyway.

This is IMHO even better than trying to make the table of type MEMORY, because then you would have to worry about writes - those should usually be persistent anyway.

So in the end, unless the machine is under much concurrent memory pressure from other apps than the MySQL server - in which case 1GB would not seem to much for a server nowadays - you will probably not have to do anything to achieve your goal :)

您可以将表引擎更改为MEMORY,它会将整个表存储在内存中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM