我有以下查询:
SELECT venues.venue_name, count( distinct checkin.user_id ) AS total_count, category_id
FROM checkin
INNER JOIN venues ON checkin.internal_venue_id = venues.venue_primary_id
WHERE checkin.item_id = '3783'
and is_category_valid = 1 and created_at >= DATE_SUB('2013-07-07 12:35:06', INTERVAL 5 DAY)
GROUP BY checkin.internal_venue_id
ORDER BY total_count DESC
LIMIT 10;
我正在努力处理此查询所需的索引。是正确的索引:
checkin: (internal_venue_id, item_id, is_category_valid, created_at, user_id)
还是有其他更理想的查询路径?