RDBMS 与文件存储的文件系统

发布于 2024-11-14 03:38:25 字数 205 浏览 3 评论 0原文

与将文件存储在文件系统中并引用 RDBMS 中的文件路径相比,将整个文件存储在 RDBMS 中是否有任何优势?

哪种方法会更快?我什么时候选择其中之一?使用哪个文件系统重要吗? (比如 ext3)

我不希望文件发生任何改变。文件可能是 json 或 xml,也可能是 pdf(可能性较小)。此外,可能不需要经常参考这些文件。它们仅用于存档。

谢谢。

Are there any advantages of storing entire files in an RDBMS over storing the files in the file system with references to the file path in the RDBMS?

Which approach shall be faster? When do I choose one over the other? Does it matter which file system is in use? (say ext3)

I do not expect the files to change at all. The files may be json or xml or might be pdf (less likely). Also, there might be no need to refer to these files often. They are only meant for archival.

Thank you.

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

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

发布评论

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

评论(3

魂归处 2024-11-21 03:38:25

鉴于文件预计不会更改,因此将文件保留在 DBMS 中的价值有限。将文件保存在 DBMS 中的主要优点是 DBMS 知道如何管理事务,但如果文件不会更改,那么这种优点就变得微不足道。

在 DBMS 中存储文件的另一个优点是数据库备份将包含这些文件;由于文件单独存储,您必须备份单独的文件存储以及 DBMS 本身,以确保所有数据的安全。

将文件存储在 DBMS 中的另一个优点是数据库可以对文件的访问实施更微妙的控制。

将文件存储在文件系统中的主要优点是可以轻松(更容易)查看您所拥有的内容。

第二个优点是您可以在 DBMS 外部备份或操作文件 - 尽管从某些角度来看这也是一个缺点。

如果文件存储在 DBMS 中的 blob 中,则普通 SQL 客户端软件可以通过普通 SQL 连接检索内容。如果 SQL 客户端软件与 DBMS 和文件不在同一台计算机上,那么您就必须担心客户端如何获取文件数据。

将文件与 DBMS 分离的另一个优点是文件可以存储在 DBMS 机器之外。另一方面,这会使将文件加载到“DBMS”中变得复杂。


总的来说,鉴于上述问题,采用“DBMS 中的文件”方法似乎有一些优势。另一方面,许多人确实采用“文件系统中的文件”方法,并且他们生存了下来。可能他们的 SQL 客户端与 DBMS 在同一台机器上,因此文件传输问题并非不可克服,但这是我最担心的一点。

Given that the files are not expected to change, there is limited value in keeping the files in the DBMS. The primary advantage of keeping files in the DBMS is that the DBMS knows how to manage transactions, but if the files won't change, then that advantage becomes minuscule.

Another advantage of storing files in the DBMS is that the database backup will contain the files; with the files stored separately, you have to backup the separate stash of files as well as the DBMS itself to keep all the data secure.

Another advantage of storing files in the DBMS is that the database can enforce more subtle controls on access to the files.

The primary advantage of storing the files in the file system is that it is easy (easier) to see what you've got.

A secondary advantage is that you can back up or manipulate the files outside the DBMS - though that is also a disadvantage from some points of view.

If the files are stored in blobs in the DBMS, then the normal SQL client software can retrieve the contents over a normal SQL connection. If the SQL client software is not on the same machine as the DBMS and the files, then you have to worry about how clients do get hold of the file data.

Another advantage of separating the files from the DBMS is that the files could be stored off the DBMS machine. On the other hand, that then complicates getting the files loaded 'into the DBMS'.


On the whole, given the issues outlined above, there seem to be some advantages with going with the 'files in DBMS' approach. On the other hand, many people do go with 'files in file system' approach, and they survive. It may be that their SQL clients are on the same machine as the DBMS, so the file transfer issues are not insurmountable, but that's the bit that has me most worried.

痴意少年 2024-11-21 03:38:25

如果文件大小小于 1MB,您可以将它们存储在 RDBMS 中,但否则请考虑将它们存储在文件系统中。请参阅 http://technet.microsoft.com/en-us/library/bb933993。 与将文件存储在文件系统中并引用 RDBMS 中的文件路径相比,将整个文件存储在RDBMS

中是否有任何优点?

如果金钱等不成问题,那么存储在 RDBMS 中是有利的,因为您将获得 RDBMS 的所有好处,而且没有从数据库中存储的引用取消引用文件的开销。

哪种方法会更快?

关系数据库管理系统

什么时候应该选择其中之一?

由实际考虑决定。如果文件 > 则考虑文件系统1MB。许多共享主机提供商不启用 FILESTREAM。

使用哪个文件系统重要吗?

我不知道这个。

If file size is less than 1MB you may store them in the RDBMS, but otherwise consider storing them on the file system. See http://technet.microsoft.com/en-us/library/bb933993.aspx

Are there any advantages of storing entire files in an RDBMS over storing the files in the file system with references to the file path in the RDBMS?

if money etc. is no problem, then storing in RDBMS is advantageous, since you will get all the benefit of a RDBMS, plus no overhead of dereferencing the file from the reference stored in the db.

Which approach shall be faster?

RDBMS

When do I choose one over the other?

dictated by practical considerations. consider file system if file is > 1MB. Many shared-hosting providers do not enable FILESTREAM.

Does it matter which file system is in use?

I don't know about this.

月下客 2024-11-21 03:38:25

补充一下 Jonathan Leffler 所写的内容:

DBMS 在处理 BLOB 时不如处理固定大小对象时高效,因此我们可以说 DBMS 不“喜欢”大对象。此外,许多 DBMS 将 BLOB 存储在表之外的单独存储中。

如果您的目标是归档目的,则单独存储文件以便于备份和检索是有意义的。您还可以将文件移动到某些后端存储并使它们“离线”以释放服务器上的空间(如果需要)。

To add to what Jonathan Leffler has written:

DBMS are not as efficient when dealing with BLOBs as when dealing with fixed-size objects, so we can say that DBMS don't "like" large objects. Also many DBMS store BLOBs outside of tables, in a separate storage.

If your goal is archiving purposes, it makes sense to store files separately for easier backup and retrieval. Also you can move files to some backend storage and make them "offline" to free space on the server (if needed).

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