I like pure relational design but sometimes there is a need for an Entity/Value method of storing data. Especially where the user needs to frequently create a new type of data.
I have seen in some commercial software that they dynamically create standard tables rather than use EV tables.
Obviously this isn’t a solve-all solution and can work only if you limit the sorts of data you can define. However, it has the following benefits:-
- The model is clearly defined - you don’t have to interrogate the schema to understand the schema.
- You get better performance as tables hold only the data for that type of data, hence no obviously unrelated rows need to be queried.
- Similarly, Indexes only hold values for the type of data that the table defines, again improving performance. (i.e. in the EV model, if the index is valueid,entityid - you will be searching values for entities that have nothing to do with your query - unless you partition the index).
So to me this sounds great, but run the idea past a DBA and you get a lot of sucking of teeth. Is this a good idea, what are the pitfalls, and has anyone tried to do this?