Database schema which can support specialized properties

前端 未结 5 1774
北海茫月
北海茫月 2020-11-28 06:39

I need to store a set of entities, of which there are several specialized versions. They have some common properties, but the specialized ones contain properties specific fo

5条回答
  •  独厮守ぢ
    2020-11-28 07:27

    I would go for the "create a table for the common properties and then a table for each of the specialized versions" method, personally.

    Reason: you say that your implementation will be done in a RDBMS and this is non-negotiable. Fine. Dumping unstructured, blob-like stuff like a serialized hashtable in a DB field goes against the design philosophy of RDBMS though, so you will have a severe hit on efficiency unless you are ok with the idea of treating the *extended_properties* field as an opaque blob, just like a gif or another binary object.

    In other words, forget querying (efficiently) for "all the objects having extended property COLOR=RED".

    The problem you have (describing OO taxonomies in a RDBMS) is definitely not new. Have a look at this, for a in-depth description of the options.

提交回复
热议问题