educative.io

Table Size Calculation - Cassandra

Hi - Wanted to understand how we got this (and I think this is an error) so wanted to check.

Instagram design question - Section 7.

For the table “UserFollow”, how was the size of each row calculated as 8 bytes. if this is Cassandra table, the primary (row)key will be the user ID (4 bytes) but it has ‘n’ number of columns with the IDs of users that are following the userID. So for a large scale celebrity case, there could be a million followers. So shouldn’t the size of this row be → [million user IDs (columns) * 4 bytes (each)] + 4 Bytes (primary ID) ?

Or did we just assume a simple use case of a single follower for the users and hence 8 bytes.

Will appreciate your response here.

Stumbled across the same thing. Seems like it should be 4 byte (key) + 4 byte for each follow.

I think “UserFollow” is meant to track who each user follows, not who they are followed by.