counting rows in a relational database is slow and in the early days of instagram this would cause the app to become completely unusable anytime justin bieber would upload a new photo imagine this is instagram state-space where you have a post table and every single time someone likes a post it's a new row in the likes table so every single time you select a post you have to run a count function to check how many likes are associated with that post and apparently he had so many likes that they couldn't even fit them in a cache a single celebrities count could destroy the entire infrastructure so to solve a problem like this you have to d normalize this database and add a total likes column to the post table every single time someone likes or unlike supposed you just update this counter so you do a little bit of extra processing when someone likes a post but this makes reading a post much more efficient
Text generated automatically and there is a chance to be inaccurate