简体   繁体   English

面向对象的数据库可以比带有ORM的关系数据库更好吗?

[英]Can object oriented databases be a better option than a relational database with an ORM?

Just thinking that a relational db with an ORM is in many ways very similar to an object oriented database. 只是认为带有ORM的关系数据库在很多方面与面向对象的数据库非常相似。 My experience lies solely with RDMS with a hint of ORM, so it seems to me that object oriented databases are very similar but without the experience I can't say for sure. 我的经验完全在于RDMS带有一些ORM,所以在我看来,面向对象的数据库非常相似,但没有经验我无法肯定。

If you have used object oriented databases and ORMs can you compare them? 如果您使用面向对象的数据库和ORM,您可以比较它们吗? What are the weak points associcated with object oriented databases compared to RBMS+ORM? 与RBMS + ORM相比,与面向对象数据库相关的弱点是什么?

What are the weak points associated with object oriented databases compared to RBMS+ORM? 与RBMS + ORM相比,面向对象数据库有哪些弱点?

The biggest weakness is the lack of standardization : no standard API, no standard query language (the OQL attempt has been a big failure) and thus the lack of portability and interoperable tools (for backup, archiving, migration, etc). 最大的缺点是缺乏标准化 :没有标准API,没有标准查询语言(OQL尝试是一个很大的失败),因此缺乏可移植性和可互操作的工具(用于备份,存档,迁移等)。 You don't want that when it comes to data. 在数据方面你不希望这样。

This explains IMO why OODBMS are a failure from an adoption point of view and why RDBMS will stay around for a while, regardless of the NoSQL movement (I have the feeling that OODBMS vendors see the NoSQL movement as an opportunity for a come back after some rebranding of their products). 这解释了IMO为什么OODBMS从采用的角度来看是失败的,以及为什么RDBMS会保持一段时间,无论NoSQL运动如何(我觉得OODBMS供应商认为NoSQL运动是一个机会让一些人回来之后品牌重塑产品)。

My experience: 我的经验:

  • RDBMS: RDBMS:
    • Frankly, I don't like working with SQL, a 15-year old language, but the reality is that you're forced to if you want anything usable, such as bulk inserts (the LINQ-to-Entity ORM framework does not support bulk inserts, so it takes 30 seconds for a 20,000 record insert, compared to 500ms for a bulk insert in SQL). 坦率地说,我不喜欢使用15岁的语言SQL,但实际情况是,如果你想要任何可用的东西,例如批量插入(LINQ-to-Entity ORM框架不支持),你就不得不这么做批量插入,因此对于20,000个记录插入需要30秒,而对于SQL中的批量插入则需要500毫秒。 You end up having to use ADO.NET for database insertions. 您最终必须使用ADO.NET进行数据库插入。
    • There are some advantages of an RDBMS over an object database, namely, the data is independent of the calling application (however, this is a weakness also, as the mapping layer makes everything slower, more complex, and more brittle). RDBMS相对于对象数据库有一些优点,即数据独立于调用应用程序(但是,这也是一个弱点,因为映射层使一切变得更慢,更复杂,更脆弱)。
    • Bottom line: Spent 6 weeks with the LINQ-to-Entity ORM framework and Microsoft SQL Server 2008 R2. 结论:使用LINQ-to-Entity ORM框架和Microsoft SQL Server 2008 R2花了6周时间。 Reasonably steep learning curve. 合理陡峭的学习曲线。
  • Object databases: Tried an object database, namely, the free, open source db4o . 对象数据库:尝试了一个对象数据库,即免费的开源db4o
    • Discovered that I could persist my objects with one line of code. 发现我可以使用一行代码来保存我的对象。
    • No schema changes to deal with, it just worked. 没有架构更改可以处理,它只是起作用。
    • Instant support for POCO (Plain Old Class Objects). 即时支持POCO(普通旧类对象)。 Create your class in code, then persist it. 在代码中创建您的类,然后保留它。 Its possible to do the same with the Entity framework, however, its a lot of work with manual mapping, and it breaks very easy. 它可以对Entity框架做同样的事情,然而,它在手动映射方面做了很多工作,并且它很容易打破。
    • Turn on transparent persistence, and it has automatic lazy loading in the background - no more checking for objects that are not loaded because of lazy loading in the Entity framework. 打开透明持久性,它在后台自动延迟加载 - 不再检查由于Entity框架中的延迟加载而未加载的对象。
    • The performance of object databases is also impressive: if you have 10 million rows in an object database, and indexing turned on, its 16ms for a three-column select. 对象数据库的性能也令人印象深刻:如果对象数据库中有1000万行,并且索引已打开,则对于三列选择,其为16ms。 That's decent. 那太体面了。
    • Bottom line: After 1 week I had the same solution as using a RDBMS for persistence, however, it was much cleaner, much less code, and more maintainable - and if I really wanted, I could use use a service to synchronize the db4o database with MSSQL. 结论:一周之后,我有了使用RDBMS进行持久性相同的解决方案,但是,它更清晰,更少代码,更易于维护 - 如果我真的想要,我可以使用服务来同步db4o数据库用MSSQL。

For really large systems in the enterprise world, consisting of say 250 million rows in a table, things like sharding and options such as clustered indexing vs. non-clustered indexing become important for performance. 对于企业界中真正大型的系统,包括表中的2.5亿行, 分片和选项(如聚簇索引非聚簇索引)之类的内容对性能非常重要。 In this case, db4o wouldn't work, it may require something more enterprisey. 在这种情况下,db4o不起作用,它可能需要更具企业性的东西。 However, if you a trivially easy method of persisting objects, then an object database will fit the bill. 但是,如果您是一个简单易用的持久化对象方法,那么对象数据库将适合该法案。 All the work of learning SQL, setting up the mapping in the ORM, dealing with installation of MSSQL, implementing your own bulk loading procedures, etc just disappears, leaving you with clean, elegant 100% managed code. 学习SQL的所有工作,在ORM中设置映射,处理MSSQL的安装,实现自己的批量加载程序等都会消失,为您留下干净,优雅的100%托管代码。

I suspect that one of the reasons that vendors have not embraced object databases as that the database market is worth $3 billion per year, and there is no reason to kill the cash cow just yet. 我怀疑供应商没有接受对象数据库的原因之一是数据库市场每年价值30亿美元,而且没有理由杀死现金牛。

Disclaimer: I have no affiliation with either Microsoft or db4o . 免责声明:我与Microsoftdb4o没有任何关系。

Chris Date agrees: Chris Date同意:

... 'object/relational' system would be nothing more nor less than a true relational system ... A proper object/relational system is just a relational system with proper type support ... which just means it's a proper relational system, no more and no less. ......'对象/关系'系统只不过是一个真正的关系系统...一个正确的对象/关系系统只是一个具有适当类型支持的关系系统......这只是意味着它是一个合适的关系系统,不多也不少。

SQL and Relational Theory: How to Write Accurate SQL Code, p 36 SQL和关系理论:如何编写准确的SQL代码,第36页

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 关系和面向对象的数据库哪一个更好,会被抑制? - Relational & Object-Oriented Database which one is better, will be suppressed? 面向对象/关系混合数据库? - Object-oriented / Relational-Hybrid Database? 关系数据库-设计领域的更好选择 - Relational Database - Better option in designing fields 面向对象与对象关系数据库的区别 - Object oriented vs. object relational database difference 对于持久化对象,面向文档的数据库是否比关系数据库更合适? - Are document-oriented databases any more suitable than relational ones for persisting objects? 为什么 NoSql 数据库的伸缩性比关系数据库好? 我应该如何在它们之间做出选择? - Why do NoSql databases scale better than relational databases? How should I choose between them? 面向文档的数据库是否意味着要取代关系数据库? - Are document-oriented databases meant to replace relational databases? 如果我们放弃关系,关系数据库是否会比NoSQL同行扩展(或更好)? - Would relational databases scale as well (or better) than their NoSQL counterparts if we drop the relationships? 图数据库中的面向对象编程 - Object oriented programming in Graph databases 面向对象的数据库是否仍在使用? - Are Object oriented databases still in use?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM