These queries appear in our slow query log and we suspect these may be contributing to a high CPU consumption. Any insight on how to optimize them?
Query 1
Takes title of article and list of keywords and tries to match against similar entries
# Query_time: 2.103713 Lock_time: 0.045125 Rows_sent: 12 Rows_examined: 38450
SET timestamp=1645104904;
SELECT
VID, title, duration, addtime, rate, ratedby, viewnumber,
type, thumb, thumbs,
MATCH(title) AGAINST ("Title of article and list of keywords"
IN BOOLEAN MODE) AS relevance
FROM video
WHERE MATCH (keyword) AGAINST ("Title of article and list of keywords"
IN BOOLEAN MODE)
AND active = "1"
AND channel = "19"
AND VID <> 40885
AND VID > 12200
AND rate >= 3.5
ORDER BY relevance DESC
LIMIT 12;
Query 2
# Query_time: 2.248775 Lock_time: 0.000104 Rows_sent: 21 Rows_examined: 241356 SET timestamp=1645105175; SELECT s.UID, u.username FROM video_subscribe AS s, signup AS u WHERE s.SUID = 224378 AND s.UID = u.UID;
Explain
SHOW VARIABLES LIKE '%ft%'
ft_boolean_syntax
+ -><()~*:""&|
ft_max_word_len
84
ft_min_word_len
4
ft_query_expansion_limit
20
ft_stopword_file
(built-in)
Type MyISAM
48,312 rows in 'video'
241,350 rows in 'signup'