MySQL Forums
Forum List  »  Optimizer & Parser

Re: High Mysql Load - CPU 360%
Posted by: Rick James
Date: November 18, 2010 01:22AM

KEY `category` (`category`),
KEY `approve` (`approve`),
-->
INDEX (category, approve, date)
INDEX (approve, date)

What's the rest of these:
SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, cat
SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
Sending data SELECT COUNT(*) as count FROM dle_post WHERE category regexp '[[:<:]](36|37|43|44|80|81|54|55|60|61|

SHOW FULL PROCESSLIST;
and surround it with [ code ] and [ / code ]
(I need to see only the non-Locked queries.)

ORDER BY RAND() -- not cheap. This might help:
INDEX(approve, id)
SELECT @id := id FROM dle_post
    WHERE approve='1'
    ORDER BY RAND()
    LIMIT 1;
SELECT id, title, date, alt_name, category, flag
    FROM dle_post
    WHERE id = @id;
The first one will be costly, but cheaper since it can run entirely in the index. The second one then fetches exactly one row.

Options: ReplyQuote


Subject
Views
Written By
Posted
2983
November 14, 2010 11:41AM
Re: High Mysql Load - CPU 360%
1223
November 18, 2010 01:22AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.