The query take more than 6 seconds for 4 million records. Any other procedure can be done to minimize the query time.

```
SELECT title_id, count(title_id) as count
FROM `title_keywords`
WHERE keyword_id in (1,2,3,4,5,6,7,8,9) 
GROUP BY title_id 
ORDER BY count desc

```

Index and unique columns

[![See the index of table on picture](https://i.stack.imgur.com/N94jX.png)](https://i.stack.imgur.com/N94jX.png)

Added composite index too[![added composite index](https://i.stack.imgur.com/wEJ66.png)](https://i.stack.imgur.com/wEJ66.png)