Store objects in a database

I have many objects, each of which can have many different attributes. many attributes overlap; for example, many objects have a name attribute. Since there are many types of objects, if there is a table built for each set of objects with the same set of attributes, this will take many tables.

I am currently using mysql and it is saved this way.

object_id|attribute_id|data

There are several tables, in different tables - different data types. For example, in an Integer table, it stores integers

Therefore, I can store all the objects in the system, and you can still filter and sort according to the attribute data. This makes queries a bit more complicated, and I don't think it is efficient.

Is this just a way to do this in mysql or other relational databases? Should I try to find other database models for this problem?

EDIT I did some research, it seems to me that I need a document-oriented database with the power of SQL.

+3
source share
5 answers

If you want to go with an RDBMS -like document-oriented database, I think you should learn mongoDB :

MongoDB's primary goal is to bridge the gap between key / value stores (which are fast and scalable) and traditional RDBMS systems (which have deep functionality).

+5
source

, , " ". . , , "ActiveRecord, Rails.

+5

Object-Attribute-Value (OAV). . , . ( ), .

Object-Relational-Mapping (ORM). . . ( ), .

+4

, , . . , " ". .

0

ORM ( ) ( , - ) , . , memcached.

0

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


All Articles