0

I was having a issue getting MySQL query cache to work. No matter what settings, I couldn't get the queries to cache on certain tables.

Once investigated. It turns out that MySQL 5.5 won't cache a query that has a table with a "dash" in it like.

Select id FROM `table-name` WHERE `id` = 1; 

However you will see Qcache_queries_in_cache, and Qcache_hits works as desired when you rename your table without the dash.

Select id FROM `tablename` WHERE `id` = 1;

Underscores also works.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Richard Dev
  • 1,110
  • 7
  • 21

1 Answers1

1

I've no idea what "Current RAM usage" means, but both MongoDB and MySQL will try to grab as much resources as they can. The best way to see what's going on is to look at the output of "top" for MySQL and MongoDB. In your "free" output, you see however that your machine has reserved 12417480 (12GB) for caches. Which is likely what the Operating System has reserved for MongoDB's memory mapped files. I don't know your query load or data access patterns so can't quite say what goes on here. You could also check in the mongodb.log file to see whether you have any slow queries.

Derick
  • 35,169
  • 5
  • 76
  • 99
  • sorry when I said "current ram usage". I was looking at the "System Monitor" in gnome. I checked "top" and it shows the highest usage at 5% which is mysql. mongo is no where on this list. Thanks for explaining the buffers/cache result. Everything is running fast and great. It just concerns me that the query_cache hit rate is so low. I will look into seeing what the optimal setting is for mongodb. – Richard Dev Feb 20 '12 at 16:30
  • I found the problem Derick. Thanks for helping. – Richard Dev Feb 24 '12 at 19:13