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.