将数据存储为对象而不是数据库列的优点

发布于 2024-09-08 01:21:26 字数 92 浏览 1 评论 0原文

将数据存储为对象而不是将它们存储在单独的表列中的优点是什么

例如: 将商品详细信息存储为 Blob,而不是将属性单独存储在商品表中(SKU、名称、价格等)

What is the advantage in storing data as an object instead of storing them in separate table columns

For example:
storing an item details as Blob instead of storing the attributes separately in an items table (SKU, Name, Price etc)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌路黄昏 2024-09-15 01:21:26

一般来说,这种事情是不鼓励的。 Blob 列旨在存储大量二进制信息的数据,例如图像或文件的内容。这是仅存储和检索的数据;它永远不会被查询、索引或以其他方式与之交互。

如果您指的是存储本来会进入列或表(例如某种类型的列表)的数据,那么这不是一个好的做法。数据库引擎旨在处理这些关系,并使存储、检索、查询等变得简单且高效。将此数据存储为二进制对象意味着您将放弃数据库为您提供的优化。

我的总体想法是:有很多比我聪明的人编写了这些 RDBMS 系统;我真的认为在存储简单列表方面我可以比他们聪明吗?

In general, that sort of thing is discouraged. Blob columns are intended to store data that's a large piece of binary information, like an image or the contents of a file. This is data that's only stored and retrieved; it's never queried against, indexed, or otherwise interacted with.

If you're referring to storing data that would otherwise go into a column or table (a list of some kind, for example), then it's not a good practice to employ. The database engine is designed to deal with these relationships and make storing, retrieving, querying, etc. against them simple and performant. Storing this data as a binary object means that you're ditching the optimizations that the database gives you.

My general thoughts are this: there are many people that are smarter than I am who write these RDBMS systems; do I really think that I can outsmart them when it comes to storing a simple list?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文