E
E
Eugene2017-02-28 13:31:01
MySQL
Eugene, 2017-02-28 13:31:01

How to make a large query start being cached by the SQL server?

On localhost, the request is cached, but not on the working site, and small requests are cached perfectly.
The request is large, I think somewhere small values ​​are worth or not worth at all.
What settings in my.cnf affect this?

SELECT count(*) as total, attribute_id, text FROM 
(SELECT DISTINCT p.product_id, p2a.attribute_id, p2a.text, p.price as realprice 
FROM oc_product p 
LEFT JOIN oc_manufacturer m ON(m.manufacturer_id=p.manufacturer_id) 
LEFT JOIN oc_product_to_category p2c ON (p2c.product_id=p.product_id) 
LEFT JOIN oc_category_path cp ON(cp.category_id=p2c.category_id) 
LEFT JOIN oc_product_attribute_id p2a ON (p2a.product_id=p.product_id) 
WHERE 1 AND p.status = '1') 
as innertable WHERE 1 GROUP BY attribute_id, text

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Smithson, 2017-02-28
@Smithson

show variables like 'query_cache%';
The query_cache_size is responsible for the cache size.
Gives only 64 MB for the cache.
The cache should be less than the available RAM and generally no more than free memory (that is, the memory that the OS will give without straining).
Play with these values ​​and see.
But if your query result is more than RAM, then the cache will not help you;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question