Entity Attribute Value Database vs. strict Relational Model Ecommerce

前端 未结 10 1566
谎友^
谎友^ 2020-11-22 05:23

It is safe to say that the EAV/CR database model is bad. That said,

Question: What database model, technique, or pattern should be used to deal with \"clas

10条回答
  •  甜味超标
    2020-11-22 05:58

    Where performance is not a major requirement, as in an ETL type of application, EAV has another distinct advantage: differential saves.

    I've implemented a number of applications where an over-arching requirement was the ability to see the history of a domain object from its first "version" to it's current state. If that domain object has a large number of attributes, that means each change requires a new row be inserted into it's corresponding table (not an update because the history would be lost, but an insert). Let's say this domain object is a Person, and I have 500k Persons to track with an average of 100+ changes over the Persons life-cycle to various attributes. Couple that with the fact that rare is the application that has only 1 major domain object and you'll quickly surmize that the size of the database would quickly grow out of control.

    An easy solution is to save only the differential changes to the major domain objects rather than repeatedly saving redundant information.

    All models change over time to reflect new business needs. Period. Using EAV is but one of the tools in our box to use; but it should never be automatically classified as "bad".

提交回复
热议问题