Faced with the following question in the database are outlined in the following table,
Each of these tables, in addition to the key fields must be a field description - a brief description/explanation of the corresponding entity. The type of this field is text.
There are several options:
1) Add a text field in each of the tables:
2) Create for each table, additional table with a description:
Users_description (id, description)
3) Create a separate table for field descriptions of the entire site
Descriptions (id description)
4) Variation of 3 points, making connections in the table descriptions
Descriptions (id, sourceType, sourceId, description)
Where sourceType in ('users', 'groups', 'posts', ... ), a sourceId = ID of the desired entity
I like option number 3 and 4.
Which option is preferable on your part?
1) Yes, wash immediately evident. You have description for each entity of their own, and add it to the tuple. Accordingly, the first option is the most acceptable.
2) What for ?
3) do you Have in this case, it must be through ajtishniki.
4) Finally can not understand.
Mine you just overworked and in your head the thoughts formed prominences :)
lauren.Prosac answered on July 9th 19 at 13:12
Of course, the first option. The rest can only be considered if you really want well perfect optimization, but.
1. These fields you have in queries will not participate, no indexes, no optimization, they simply don't need.
2. To retrieve data from them, if it is required, for example, to create a description of the database, we need queries trickier. Creation and implementation of all but the first option will take time that is better spent on base development
3. All those tricky queries would not be tolerated in any system of automatic generation of descriptions.
4. It is unlikely that the description so often coincide them so much that their optimization will speed up the selection.