PostgreSQL 中的对象
PostgreSQL 是第一个在关系系统中引入对象(序列化)的数据库……这就是我对对象和 PostgreSQL 的全部了解。我一直在做一些研究,但坦率地说没有发现任何好的东西。有没有关于这方面的好的文章/书籍?
PostgreSQL was the first database that introduced objects in relational systems (serialization)... and that is all what I know about objects and PostgreSQL. I have been doing some research, but frankly didn't find anything good. Is there any good articles/books about it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我不确定“在关系系统中引入对象”是什么意思。 PostgreSQL 确实有自定义类型,但这些与 OOP 完全不同。
AFAIK PostgreSQL 有时被称为“对象关系数据库”的唯一原因是因为它 支持表继承。然而,继承的主要用例实际上是表分区 ;性能限制意味着它对于实现“对象继承”不是很有用(即将发布的 PostgreSQL 9.1 版本将 消除其中一些限制)。
底线:这里没什么可看的,PostgreSQL 只是另一个关系数据库。
I'm not sure what you mean with "introducing objects in relational systems". PostgreSQL indeed has custom types, but those are nothing like OOP.
AFAIK the only reason why PostgreSQL is sometimes called an "object-relational database" is because it supports table inheritance. However, the main use case of inheritance has actually been table partitioning; the performance limitations mean that it's not very useful for implementing "object inheritance" (The upcoming PostgreSQL 9.1 release will remove some of these limitations).
Bottom line: Nothing to see here, PostgreSQL is just another relational database.
Postgres 7 文档的前言解释了为什么他们认为自己是对象关系的先驱概念(在 Postgres 8 及更高版本中,这一切都被改写/重组/删除)。 历史文档提供了更多详细信息。
The preface of the Postgres 7 documentation explains why they consider themselves as having pioneered object-relational concepts (in Postgres 8 and later, this got all rephrased/restructured/deleted). The history document gives more details.
历史文献讲述了这个故事,但我很惊讶地看到这么多评论者提到了面向对象编程,这完全是一个单独的主题。
Postgres 最初是加州大学伯克利分校的一个突破性研究项目,由 Michael Stonebraker 领导,他之前在那里领导过 Ingres 开发项目。
对象关系数据库的经典示例涉及非表格数据的存储和检索,例如图像、音频、媒体等。Stonebreaker 预见了“数据爆炸”,特别是在二进制大型对象领域,例如图像、等等,并意识到传统的 RDBMS 无法胜任这项任务。
用于描述“愿景”的示例之一是需要根据数据本身的属性,而不仅仅是元数据(带有字符串“日落”的名称、标签等)来搜索图像数据库,查找日落图片.)。这个概念意味着革命性索引方法的发展,例如,基于主色谱(日落往往是红色、橙色)或其他属性,具体取决于数据类型。这些想法在 Illustra 产品中实现了商业化,该产品是原始 Postgres 团队工作的直接后代。
事实上,大多数 ORDBMS 功能都是从 Postgres 代码库中减去的,这就是我们今天所知的 PostgreSQL。从这个意义上来说,结论是正确的。甚至 PostgreSQL 也缺乏原始 Postgres 的 ORDBMS 方面。
那么,Oracle 中的对象呢?还是不在那儿。 RDBMS 中的 OOP?根本不是同一个话题。
The historical documents tell the tale, but I was surprised to see that so many commentors mentioned Object Oriented Programming, which is a separate subject entirely.
Postgres started at UC Berkeley as a ground breaking research project, led by Michael Stonebraker, who previously led the Ingres development project there.
The classic example of an Object Relational Database involved storage and retrieval of of non-tabular data, such as images, audio, media, etc. Stonebreaker forsaw the "data explosion", especially in the area of Binary Large Objects, such as images, etc., and realized that the traditional RDBMS was not up to the task.
One of the examples used to describe "the vision" was the need to search an image database, for pictures of sunsets, based on attributes of the data itself, not merely meta-data (names with the string "sunset", labels, etc.). The concept implied the development of revolutionary indexing methods, for example, based on dominant color spectrum (sunsets tend to be red, orange), or other attributes, depending on the data type. These ideas were commercialised in the Illustra product, which was a direct descendant of the original Postgres team's work.
In fact, most of the ORDBMS features were subtracted from the Postgres code base, which became that PostgreSQL that we know today. In that sense, the conclusion is correct. Even PostgreSQL lacks the ORDBMS aspect of the original Postgres.
So, objects in Oracle? Still not there. OOP in an RDBMS? Not the same topic at all.
那么,从某些角度来看,Postgresql 可以将表实体视为复合类型,可以将其视为对象。
与数组混合这可以非常强大
当然它不是真正的 OOP。
Well, from some point of view, Postgresql can consider the tables entities as composite type which can be seen as objects.
Mixed with Array this can be very powerful
Of course it is not real OOP.
据我所知,第一个提供全面对象支持(具有用户定义类型、嵌套、主从关系等)的 RDBMS 是 Oracle。他们甚至在后来的版本中添加了继承,但在我看来这是一种矫枉过正。请参阅取自非常旧的 Oracle 客户端安装(超过 15 年)的示例 SQL 脚本。
As far as I know, first RDBMS offering full scale objects support (the one with user defined types, nesting, master-detail relation etc.) was Oracle. They even added inheritance in later versions, but in my opinion it was an overkill. See example SQL script taken from very old Oracle client installation (more than 15 years old).
正如 Martin v. Löwis 所提到的,旧 PostgreSQL 7 文档 在本主题中简单列出了以下 3 点:
恕我直言,我猜这些功能在 PostgreSQL 在 80 年代引入时是最前沿的,但是,如今在其他数据库中广泛使用。虽然 PostgreSQL 仍在推销“对象”这个术语,但人们还是感到困惑。
As mentioned by Martin v. Löwis, the old PostgreSQL 7 document simply lists the following 3 points in this topic:
IMHO, I guess these features were cutting edge when PostgreSQL introduced them back in the 80s, which, however, are widely available in other databases nowadays. While PostgreSQL still marketing the term "object" and people are confused.