Sample Header Ad - 728x90

Database Schema design - Sparse matrix; when does it make sense?

1 vote
1 answer
113 views
I was exploring the different reasoning for schema designs. I came across the following scenario. Scenario 1 has a data schema that has a bunch of columns, but the data is sparse mostly nulls (for whatever reason). Scenario 2 is when the data is more pivoted (few columns) but a bunch more rows. I couldn't figure out a general use-case rule for using these scenarios. Does it make sense for constant changing schemas with new categories for scenario 2? What scenario would make scenario 1 valid? There is so many nulls, but this exists quite a bit. Scenario 1: Product Quantity Number_of_Holes number of legs Table 0 null 4 Chair 1 null 4 Glass 1 1 null Scenario 2: Product Category Value Table Quantity 0 Chair Quantity 1 Glass Quantity 1 Table Number of Holes null Chair Number of Holes null Glass Number of Holes 1 Table number of legs 4 Chair number of legs 4 Glass number of legs null Purely a theoretical question. This is something I've encountered in my work but no guidance on reasoning.
Asked by Raymond Hoang
Jun 12, 2023, 09:46 AM
Last activity: Sep 7, 2023, 07:06 PM