Note that there are some explanatory texts on larger screens.

plurals
  1. POmysql query taking too long to execute
    primarykey
    data
    text
    <p>I have a query that is taking way too long to execute (4 seconds) even though all the fields i am querying against are indexed. Below are the query and the explain results. Any ideas what the problem is? (mysql CPU usage shoots up to 100% when executing the query</p> <pre><code>EXPLAIN SELECT count(hd.did) as NumPo, `hd`.`sid`, `src`.`Name` FROM (`hd`) JOIN `result` ON `result`.`did` = `hd`.`did` JOIN `sf` ON `sf`.`fid` = `hd`.`fid` JOIN `src` ON `src`.`sid` = `hd`.`sid` WHERE `sf`.`tid` = 2 AND `result`.`set` = 'xxxxxxx' GROUP BY `hd`.`sid` ORDER BY `NumPo` DESC LIMIT 10; +----+-------------+--------------+--------+-------------------------+---------+---------+--------------------------+------+----------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+--------------+--------+-------------------------+---------+---------+--------------------------+------+----------------------------------------------+ | 1 | SIMPLE | sf | ref | PRIMARY,type | type | 2 | const | 4 | Using index; Using temporary; Using filesort | | 1 | SIMPLE | hd | ref | PRIMARY,sid,fid | FeedID | 4 | f2.sf.fid | 3 | | | 1 | SIMPLE | result | ALL | resultset | NULL | NULL | NULL | 5322 | Using where; Using join buffer | | 1 | SIMPLE | src | eq_ref | PRIMARY | PRIMARY | 4 | f2.hd.sid | 1 | | +----+-------------+--------------+--------+-------------------------+---------+---------+--------------------------+------+----------------------------------------------+ </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload