Answer the question
In order to leave comments, you need to log in
Organization of storage in the database of dynamic fields and their values?
Hello.
There was a problem during the storage design phase. The working version of the application, created on Symfony, will have the ability to add additional fields to objects, and edit these fields. The fields are standard - text, textarea, radio, checkbox, radio and checkbox groups, file, etc.
The first thought was to do it this way:
FIELDS:
- id
- type
- name
- default
- size
FIELDS_VALUE:
- id
- field_id
- value
OBJECT_FIELDS_ID:
- field_id
- object_type
However, one object is planned to have fields from 15 pieces, and there will be more than 200,000 objects.
The question is, how can you properly organize such a structure for dynamically changing the fields of an object? With the organization written above, searching by values is problematic, as it will be very slow. Of course, it would be possible to move the fields to a separate table, but when changing the fields, there is no desire to pick the code.
At least in which direction to look?
Answer the question
In order to leave comments, you need to log in
You yourself described the positive and negative aspects of the EAV model. You just need to make a prototype. 200k fields is not that much, and the question is how often do you search by fields. You need to take xhprof (etc) and optimize already. For information: By the way, MAGENTO is completely built on EAV, and there are a lot of stores on it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question