1

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.

Glorfindel
  • 2,205
  • 5
  • 19
  • 26

1 Answers1

0

Scenario 1 is best for querying, scenario 2 has a lot of duplicated values so it also takes more space and will get slower. In this case, it is not many values, but if the database gets bigger this will become an issue.

MathijsG
  • 1
  • 1