Answer the question
In order to leave comments, you need to log in
What can you think of instead of this heavy request?
SELECT r.id, c.id,
/* тут идёт сложный подзапрос, но в контексте вопроса нам это не интересно */ 123 AS `count`
FROM `region` r
JOIN `category` c on 1=1
Answer the question
In order to leave comments, you need to log in
we should try not to make hundreds of thousands of subqueries, but to “leftjoin” on the result of the calculation (one query) of the quantities in the desired partition. you can even try memory tables.
according to the topic - the muscle has one merge algorithm. in this case, it will read both tables at a time, but the cursor with the result of the merge simply may not fit in the buffer and recordings will begin on disk, brakes, hell and israel (
option B. when filling tables with records that are being counted, calculate the necessary counts .working
option.calculate on the fly the necessary counts and cache.for especially stubborn splitting options, warm up the cache.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question