Derby 与 PostgreSql 性能比较

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2141487/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-20 00:00:06  来源:igfitidea点击:

Derby vs PostgreSql Performance Comparison

postgresqlglassfishderby

提问by Austin

We are doing research right now on whether to switch our postgresql db to an embedded Derby db. Both would be using glassfish 3 for our data layer. Anybody have any opinions or knowledge that could help us decide?

我们现在正在研究是否将我们的 postgresql 数据库切换到嵌入式 Derby 数据库。两者都将使用 glassfish 3 作为我们的数据层。有人有任何意见或知识可以帮助我们做出决定吗?

Thanks!

谢谢!

edit: we are writing some performance tests ourselves right now. Looking for answers more based on experience / first hand knowledge

编辑:我们现在正在自己编写一些性能测试。更多地根据经验/第一手知识寻找答案

回答by Dan

I know I'm late to post an answer here, but I want to make sure nobody makes the mistake of using Derby over any production-quality database in the future. I apologize in advance for how negative this answer is - I'm trying to capture an entire engineering team's ill feelings in a brief Q&A answer.

我知道我在这里发布答案已经晚了,但我想确保将来没有人会错误地将 Derby 用于任何生产质量的数据库。对于这个答案的否定程度,我提前道歉 - 我试图在简短的问答中捕捉整个工程团队的不良情绪。

Our experience using Derby in many small-ish customer deployments has led us to seriously doubt how useful it is for anything but test environments. Some problems we've had:

我们在许多小型客户部署中使用 Derby 的经验使我们严重怀疑它对除测试环境外的任何东西都有多大用处。我们遇到的一些问题:

  • Deadlocks caused by lock escalations - this is the biggest one and happens to one customer about once every week or two
  • Interrupted I/Os cause Derby to fail outright on Solaris (may not be an issue on other platforms) - we had to build a shim to protect it from these failures
  • Can't handle complicated queries which MySQL/PostgreSQL would handle with ease
  • Buggy transaction log implementation caused a table corruption which required us to export the database and then re-import it (couldn't just drop the corrupted table), and we still lost the table in the process - thank goodness we had a backup
  • No LIMITsyntax
  • Low performance for complicated queries
  • Low performance for large datasets
  • 锁升级导致的死锁——这是最大的死锁,大约每周或每两周发生在一位客户身上
  • 中断的 I/O 导致 Derby 在 Solaris 上彻底失败(在其他平台上可能不是问题)——我们必须构建一个垫片来保护它免受这些故障的影响
  • 无法处理 MySQL/PostgreSQL 可以轻松处理的复杂查询
  • 错误的事务日志实现导致表损坏,这需要我们导出数据库然后重新导入它(不能只是删除损坏的表),我们仍然在此过程中丢失了表 - 谢天谢地我们有备份
  • 没有LIMIT语法
  • 复杂查询的低性能
  • 大型数据集的低性能

Due to the fact that it's embedded, Derby is more of a competitor to SQLite than it is to PostgreSQL, which is an extremely mature production-quality database which is used to store multi-petabyte datasets by some of the largest websites in the world. If you want to be ready for growth and don't want to get caught debugging someone else's database code, I would recommend not using Derby. I don't have any experience with SQLite, but I can't imagine it being much less reliable than Derby has been for us and still being as popular as it is.

由于它是嵌入式的,因此与 PostgreSQL 相比,Derby 更像是 SQLite 的竞争对手,PostgreSQL 是一种非常成熟的生产质量数据库,世界上一些最大的网站用于存储多 PB 的数据集。如果您想为增长做好准备并且不想在调试其他人的数据库代码时被抓到,我建议您不要使用 Derby。我对 SQLite 没有任何经验,但我无法想象它比 Derby 对我们来说更不可靠并且仍然像它一样受欢迎。

In fact, we're in the process of porting to PostgreSQL now.

事实上,我们现在正处于移植到 PostgreSQL 的过程中。

回答by Ron de Jong

Derby still is relatively slow in performance, but ... where ever your Java application goes your database server goes, completely platform independent. You don't even need to think about installing a DB server where your Java app is being copied to.

Derby 的性能仍然相对较慢,但是……无论您的 Java 应用程序运行到何处,您的数据库服务器都运行在完全独立的平台上。您甚至不需要考虑安装您的 Java 应用程序复制到的数据库服务器。

I was using MySQL with Java, but having an embedded implementation of your Database server sitting right within my Java App is just stunning and unprecedented productivity, freedom and flexibility.

我将 MySQL 与 Java 结合使用,但是在我的 Java 应用程序中嵌入数据库服务器的实现是令人惊叹且前所未有的生产力、自由和灵活性。

Always having a DB server included whenever and wherever on any platform for me is just heaven !!!

无论何时何地,在任何平台上始终包含数据库服务器对我来说简直就是天堂!!!

回答by davidm

When looking at the H2 databases stats site, it's worth reading follow up discussion which comes out in favour of Derby compared to the H2 conclusions. http://groups.google.com/group/h2-database/browse_thread/thread/55a7558563248148?pli=1

在查看 H2 数据库统计站点时,值得阅读后续讨论,与 H2 结论相比,该讨论有利于 Derby。 http://groups.google.com/group/h2-database/browse_thread/thread/55a7558563248148?pli=1

回答by Sands

Have not compared Postgresql to Derby directly. However, having used both in different circumstances, I have found Derby to be highly reliable. However you will need to pay attention to Derby configuration to ensure it suits your application needs.

没有直接将 Postgresql 与 Derby 进行比较。但是,在不同情况下使用这两种方法后,我发现 Derby 非常可靠。但是,您需要注意 Derby 配置以确保它适合您的应用程序需求。

回答by Bryan Pendleton

There are a number of performance test suites that are included as part of the Derby source code distribution itself; they are used by Derby developers to conduct their own performance testing of Derby. So if you need examples of performance tests, or want additional ones, you could consider using those. Look in the subdirectory named java/testing/org/apache/derbyTesting/perf in the Derby source distribution.

有许多性能测试套件作为 Derby 源代码分发本身的一部分包含在内;Derby 开发人员使用它们来进行他们自己的 Derby 性能测试。因此,如果您需要性能测试示例,或者想要其他示例,您可以考虑使用这些示例。查看 Derby 源代码分发中名为 java/testing/org/apache/derbyTesting/perf 的子目录。

回答by dangerstat

Some stats from the H2 database site here: http://www.h2database.com/html/performance.html

来自 H2 数据库站点的一些统计数据:http: //www.h2database.com/html/performance.html