Schema smaller SQL database table - practical compromise

This question is an attempt to find a practical solution to this question .

I need a schema with a smaller schema for my SQL database. However, I can limit the flexibility to train it throughout the SQL paradigm. Migrating to a smaller database schema may be an option in the future, but right now I'm stuck with SQL.

I have a table in an SQL database (call her Foo). When a string is added to this, it should be able to store an arbitrary number of meta fields with it. An example would be the ability to attach arbitrary metadata such as tags, collaborators, etc. All fields are optional, but the problem is that they are of different types. Some may be numeric, some may be text, etc.

A simple design that connects Footo the table OptionalValueswith the fields, such as name, value_type, value_string, value_int, value_dateand so on, seems to direct, though it falls on the whole the EAV , which Alex mentions in the last answer, and looks pretty wasteful. In addition, I think that questions from this, when it grows up, will be rather slow. However, I am not going to search or sort anything in this table. All I need is that when I get the string from Foo, these additional attributes can also be obtained.

Are there any recommendations for introducing this type of installation into an SQL database, or am I just misunderstanding all this?

+3
source share
1

"Metafields" "Foo" XML JSON.

+1

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


All Articles