使用 Java 从 oracle DB 保存/检索巨大 blob 的性能问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6321695/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
performance problem in saving/retrieving huge blob from oracle DB using Java
提问by carnot
I am saving huge blob(500 MB) into oracle DB using JDBC. It takes a lot of time in insertion and later on retrieval.
我正在使用 JDBC 将巨大的 blob(500 MB)保存到 oracle DB 中。插入和检索需要花费大量时间。
Please suggest, if any of you have encountered this problem.
请提出建议,如果你们中有人遇到过这个问题。
回答by Gary Myers
Lots of non-database people are really scared of sticking BLOBs and CLOBs in databases. They shouldn't be. Oracle manages them very well. Also bear in mind that Oracle also develops file systems (including BTRFS) so know about storing all kinds of data. Data in the database can be better protected against media or system failure, secured against unauthorised access and audited for improper use.
许多非数据库人员真的很害怕在数据库中粘贴 BLOB 和 CLOB。他们不应该。Oracle 对它们进行了很好的管理。还要记住,Oracle 还开发了文件系统(包括 BTRFS),因此了解存储各种数据。可以更好地保护数据库中的数据免受媒体或系统故障的影响,防止未经授权的访问并审计不当使用。
You should be using 11g and SecureFile LOBS. This document on SecureFile performancegives guidelines to achieving performance that is as good or better than regular filesystem storage.
您应该使用 11g 和SecureFile LOBS。这份关于SecureFile 性能的文档为实现与常规文件系统存储一样好或更好的性能提供了指导。
Of course it is worth checking what the bottleneck is first. If it is the network between the app server and the DB server then no amount of database tuning will bypass the issue.
当然,首先要检查瓶颈是什么。如果是应用服务器和数据库服务器之间的网络,那么再多的数据库调优都不会绕过这个问题。
回答by Charlie Martin
500 MB blob? Oh my God.
500 MB 的 Blob?我的天啊。
Look, seriously, the answer is "don't dothat!" Relational databases aren't intended for that or optimized for it; the way the tables and filesystem have to be organized for indexing and searching aren't suited for that kind of big indigestable lump.
认真地看,答案是“不要那样做!” 关系数据库并非为此目的或为此进行优化;为索引和搜索而必须组织表和文件系统的方式不适合那种难以消化的大块。
Consider, instead, creating a separate filesystem for this big lumps, and storing a pathname in the database.
相反,考虑为这些大块创建一个单独的文件系统,并在数据库中存储一个路径名。