2

Here's what your query returns when I test it on MySQL 8.0: mysql> SELECT COUNT(*) OVER (PARTITION BY country_id) AS count, user_id, country_id, DATE(date) as date, group_concat(search_keywords) as search_keywords FROM users_search_activity group by country_id; +-------+---------+------------+------------+-----------------------------------------+ | ...


1

It sounds like col_1 is not the first (or only) column in index ind5. Or, many rows have col_1 = 10. Please provide output from SELECT col_1, COUNT(*) FROM mytable GROUP BY col_1; Meanwhile, INDEX(col_1, status) Is optimal for all three queries. That IN and that OR are optimized the same. Tacking status onto the index makes it "covering", hence ...


Only top voted, non community-wiki answers of a minimum length are eligible