M
M
Misha2017-12-08 14:44:04
MySQL
Misha, 2017-12-08 14:44:04

What structure to choose for the database?

Greetings.
The database will store 100 million records. Each product, in addition to other properties, has 5 modifications. Each of the modifications can take values ​​from NULL to 12. I.e. there will be 371293 different unique modifications in total.

+---------+-----+--------+--------+--------+--------+--------+
|   товар | ... |  мод.1 |  мод.2 |  мод.3 |  мод.4 |  мод.5 |
+---------+-----+--------+--------+--------+--------+--------+
| товар 1 | ... |   null |   null |   null |   null |      1 |
| товар 2 | ... |   null |   null |     12 |     12 |      1 |
| товар 3 | ... |   null |      1 |      2 |      3 |      4 |
| товар 4 | ... |      5 |      6 |      7 |      8 |      9 |
| товар 5 | ... |   null |   null |   null |   null |      1 |
+---------+-----|--------+--------+--------+--------+--------+

There are two storage options:
1. All in one table.
2. In two related tables. In one product, in the other pre-generated 371293 records with all possible properties of the product.
Which storage option is best?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Entelis, 2017-12-08
@DmitriyEntelis

I didn’t really understand the description, with live examples it would be clearer.
Are all products the same?
That is, conditionally - for all products, modification No. 1 - color, value 1 - red, 2 - blue, etc.?
In this case, we store 5 tablets - reference books with a decoding of the modifier values.
In the products table, we store 5 fields with the values ​​of these modifiers

A
asd111, 2017-12-08
@asd111

For goods it is better to take NoSQL. The same MongoDB is well suited for storing goods.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question