S
S
Sergey2018-11-28 13:09:39
Database design
Sergey, 2018-11-28 13:09:39

Storing data in JSON or EAV?

Dear friends, help me solve the problem of application architecture.
I work in a small manufacturing company, we produce various equipment.
There are about 20 types of devices, and each has about 20 modifications that often change.
In the production of each device, at the moment we use paper quality certificates, this is an internal document in which we record production operations, who performed when they performed the serial numbers of components, and so on. For several years, we have accumulated quite a lot of data from "Passports" and the question arose of transferring this entire economy to electronic form.
What is the crux of the matter. For each production operation, depending on the type and modification of the device, it is necessary to save different information.
As I see the data storage method:
For each type of device there is a static data set, for example, the serial number of the device, the serial number of the electronic board, and so on. as well as a set of dynamic data for each production operation, for example, when assembling, you need to check the type of screws, check stickers, etc., when setting up, check parameter 1, 2 ....
I want to make a template for each operation and store it in the database , that is, when creating a new operation, I load this template from the database, fill it with data and save it to the database in this form. For storage, I plan to use jsonb in postgresql.
I also considered the option of using EAV, but it seems to me that this will give a large load on the database and affect the performance of the program.
Can you tell me how viable this option is or maybe there are some solutions to this problem? Or tell me which way to dig?
Thank you in advance for your help!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2018-11-28
@Rsa97

If the data is only stored and taken in its entirety for display, then JSON.
If the data needs to be searched and/or sorted, then a separate table (EAV).

S
sim3x, 2018-11-28
@sim3x

I also considered the option of using EAV, but it seems to me that this will give a large load on the database and affect the performance of the program.
json is slightly faster than eav
The difference will be discernible over millions of positions
For each device type there is a static set of data, such as device serial number, electronic board serial number, etc.
as well as a set of dynamic data for each production operation, for example, when assembling, you need to check the type of screws , check stickers, etc., when setting up, check parameter 1, 2 ....
It is not at all clear what the textual information to the database has to do with it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question