Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Would it make sense to put booleans in their own tables in order to save space?

Let’s say you have a table called "user" with 1.000.000 records.

In this table you have a column named "banned". If the cell has a value of "true" this means that the user has been banned and can no longer access their account.

However out of the 1.000.000 users only 10.000 have ever been banned, which means that there are 990.000 records for which the storage that the column "banned" has been taking up has been somewhat wasted.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Wouldn’t it make more sense to have a seperate table that stores the id’s of the 10.000 users that have been banned, in order to save space?

>Solution :

It depends. You can’t follow this column segregation strategy to minimize the storage without the tradeoff. Performance and latency will be the two major factor directly impacted by this approach. At the end you need collective data to make the decision.

How you can collect the data?

You can aggregate that either directly at database level by joining the tables or at application level by invoking separate network calls to collect the data from different tables.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading