动态数据库模式 [英] Dynamic Database Schema

查看:223
本文介绍了动态数据库模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是一个动态逻辑数据库模式提供存储推荐的架构?

What is a recommended architecture for providing storage for a dynamic logical database schema?

要澄清:如果需要一个系统来提供,其模式可以延长或由其用户一旦投入生产,有什么好的技术,数据库模型或存储引擎,使这种改变的模型存储?

To clarify: Where a system is required to provide storage for a model whose schema may be extended or altered by its users once in production, what are some good technologies, database models or storage engines that will allow this?

几种可能的做法来说明:

A few possibilities to illustrate:


  • 创建/通过动态生成DML变更数据库对象

  • 有大量稀疏物理列创建表,并只使用了'覆盖'逻辑模式要求

  • 创建狭长存储动态列值的行则需要进行旋转来创建一个短,宽包含特定实体的所有值行集表

  • 使用BigTable的/ SimpleDB中的PropertyBag类型系统

根据现实世界的经验的任何答案将是极大的AP preciated

Any answers based on real world experience would be greatly appreciated

推荐答案

你所建议的是不是新的。大量的人已经尝试过了......大多数都发现,他们追逐无限的灵活性,而是用多结束,比少得多。这是蟑螂屋的数据库设计的 - 数据进去,但是这几乎是不可能把它弄出来。尝试和概念化写作code对任何类型的约束,你就会明白我的意思。

What you are proposing is not new. Plenty of people have tried it... most have found that they chase "infinite" flexibility and instead end up with much, much less than that. It's the "roach motel" of database designs -- data goes in, but it's almost impossible to get it out. Try and conceptualize writing the code for ANY sort of constraint and you'll see what I mean.

最终的结果是一种典型的系统,该系统是更加难以调试,维护和充分的数据一致性问题。这不是的总是的情况下,但往往不是,那是怎么结束。这主要是因为程序员(S)没有看到这个火车失事来了,不防守$反对C $℃。此外,经常结束了无限的灵活性真的是没有必要的情况下;这是一个非常糟糕的嗅觉当开发团队得到了规范,说:哎呀我不知道他们会在这里放什么样的数据,所以让'让他们放无所谓......和最终用户也蛮好有,他们可以使用pre定义的属性类型(code了一个通用的电话号码,让他们创建它们中的任何# - 这是一个很好的标准化体系琐碎并保持灵活性和完整性!)

The end result typically is a system that is MUCH more difficult to debug, maintain, and full of data consistency problems. This is not always the case, but more often than not, that is how it ends up. Mostly because the programmer(s) don't see this train wreck coming and fail to defensively code against it. Also, often ends up the case that the "infinite" flexibility really isn't that necessary; it's a very bad "smell" when the dev team gets a spec that says "Gosh I have no clue what sort of data they are going to put here, so let 'em put WHATEVER"... and the end users are just fine having pre-defined attribute types that they can use (code up a generic phone #, and let them create any # of them -- this is trivial in a nicely normalized system and maintains flexibility and integrity!)

如果你有一个很好的研发团队和有密切知道的问题,你就会有这样的设计来克服,就可以顺利code了一个精心设计的,并不十分越野车系统。大多数时候。

If you have a very good development team and are intimately aware of the problems you'll have to overcome with this design, you can successfully code up a well designed, not terribly buggy system. Most of the time.

为什么要对你堆积了这么多的可能性开始了,虽然?

Why start out with the odds stacked so much against you, though?

不相信我?谷歌一个真正的查找表或单表的设计。一些好成绩:
<一href=\"http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:10678084117056\">http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:10678084117056

Don't believe me? Google "One True Lookup Table" or "single table design". Some good results: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:10678084117056

<一个href=\"http://thedailywtf.com/Comments/Tom_Kyte_on_The_Ultimate_Extensibility.aspx?pg=3\">http://thedailywtf.com/Comments/Tom_Kyte_on_The_Ultimate_Extensibility.aspx?pg=3

<一个href=\"http://www.dbazine.com/ofinterest/oi-articles/celko22\">http://www.dbazine.com/ofinterest/oi-articles/celko22

<一个href=\"http://thedailywtf.com/Comments/The_Inner-Platform_Effect.aspx?pg=2\">http://thedailywtf.com/Comments/The_Inner-Platform_Effect.aspx?pg=2

这篇关于动态数据库模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆