niiwill's avatar

Indexing frequently changed column in DB table

Hey folks,

I have a Laravel app that contains table posts and an inside column "likes_count" that represents the number of likes for each post. I have a task to get the top 20 post orders by the number of likes, and I am confused should I set the index on that column, because that column is changed for every post every second while users like posts? Should I set the index on frequently changed column or continue without index because it will slow insert updates etc?

0 likes
1 reply
Thunderson's avatar

put index on likes_count, slow insert updates will be almost unseen by user.

Please or to participate in this conversation.