Row vs Column Table Design

Shashwat Agarwal
1 min readAug 19, 2022

--

Using the Spotify database as an example, we can better comprehend this. Let’s assume that we will record every install and uninstall action taken by both new and existing users.

Column Table Design

Table Columns - user_id, app_install_date, app_uninstall_date

The system updates specific column for that user whenever they perform an activity.

Row Table Design

Table Columns - user_id, activity_name, activity_date

The system adds an activity row for that user whenever they perform an activity.

The cost of insertion is lower than that of updating. Updates can be time-consuming since they necessitate querying vast amounts of data. In this case, row table design obviously prevails over column table design.

When the database needs to be updated to reflect a new activity. In column design, a new column must be added; this is not a recommended process for a production database. The row design, however, is easily able to handle this situation.

When the data that needs to be stored is not updated or updated less frequently, column design is preferable since it is more aesthetically pleasing and easier to query through than row design.

This was an under 2 min explanation for Row and Column Table Design. I hope the explanation was clear and you were able to catch this easily.

I referred this video to get a clear understanding, Feel free to check out.

--

--

Shashwat Agarwal

Software Developer | Full of innovative ideas that I’ll probably never get around to executing