Is this a “correct” database design?

后端 未结 5 654
时光说笑
时光说笑 2021-01-12 03:04

I\'m working with the new version of a third party application. In this version, the database structure is changed, they say \"to improve performance\".

The old vers

5条回答
  •  心在旅途
    2021-01-12 03:46

    No, it's not. It's terrible.

    until the max number of column (handled by application) is reached, then a new table is created.

    This sentence says it all. Under no circumstance should an application dynamically create tables. The "old" approach isn't ideal either, but since you have the requirement to let users add custom properties, it has to be like this.

    Consider this:

    • You lose all type-safety as you have to store all values in the column "PROPERTY_VALUE"
    • Depending on your users, you could have them change the schema beforehand and then let them run some kind of database update batch job, so at least all the properties would be declared in the right datatype. Also, you could lose the entity_id/key thing.
    • Check out this: http://en.wikipedia.org/wiki/Inner-platform_effect. This certainly reeks of it
    • Maybe a RDBMS isn't the right thing for your app. Consider using a key/value based store like MongoDB or another NoSQL database. (http://nosql-database.org/)

提交回复
热议问题