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开发者_StackOverflow中文版 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 :)
You can change the table engine to MEMORY and it will store the full table in memory.
精彩评论