What is wrong with this query that causes MySQL cpu usage to spike? The cpu usage is like this until the db runs out of memory.
$sql = "SELECT c.*
FROM hatt_postmeta a
inner join hatt_postmeta b
ON a .post_id = b .post_id
inner join hatt_postmeta c
ON a .post_id = c .post_id
WHERE ( a .meta_key = 'ht_size_width'
AND a .meta_value = 165 )
AND ( b .meta_key = 'ht_size_ratio'
AND b .meta_value = 70 )
AND c .meta_key = 'ht_size_diameter'
GROUP BY c .meta_value
ORDER BY c .meta_value ASC";
$result= $wpdb->get_results( $sql );
Update: every query is getting 100% cpu usage