How to create a database where the table of basic entities has 25 + columns, but the columns of one object receive an average of <20%?

Objects that must be saved have 25+ properties (table columns). Entities are quite diverse, which means that most of the columns are empty. On average, I would say properties of less than 20% (<5) matter in any particular element. So, I have a lot of redundant empty columns for most rows of the table. Almost all columns are decimal numbers.

Given this scenario, would you suggest serializing the columns, or perhaps create another table named “Property” that would contain all the possible properties, and then create another table “EntityProperty” that would display the property for the object using foreign keys? Or will you leave it as it is?

An example of a scenario in which such redundancy may occur may be as follows:

We have an imaginary universe with many planets. We create a space game, and each planet has 30 different minerals. Most planets have only 2-3 minerals.

"" 30 , . , "" 25 + , . , . , 500 -1. , , . , 500 000-1 000 000 , .. .

. , "" , "". 30 , . "PlanetMineral", , , , , . -, , . SQL- LINQ to SQL, , . (.. , .) , . - (, 1/15) . , - , .

, , .

+3
2

:

  • () ?
  • ?
  • ?
  • ?

, , ? , . () .

, , , ( ).

(, property1 < 123), , , .

, Property/EntityProperties.


, (< 1M), , , , - / (SQLServer) .

0

, 1 . , EntityProperty . - , , SQL , , , .

0

Source: https://habr.com/ru/post/1741561/


All Articles