与在 TOAD 中运行查询相比,executeQuery 的运行时间是其六倍

发布于 2024-11-02 10:28:57 字数 406 浏览 1 评论 0原文

我继承了一个……嗯,我想我可以将其称为一个 #### Struts 应用程序,并负责优化 Levey-Jennings 流程,以检查我们的质量控制标准是否符合要求。

该过程本身运行良好,但即使数据集很小,性能时间也始终会出现巨大的峰值。我测试了算法每个部分之间的时间,发现最消耗时间的是 Java 的 executeQuery() 方法。

最近我运行该应用程序并记录执行时间为 10 秒。 executeQuery() 本身就花费了六秒。我很想知道问题所在,因此将查询放入 TOAD 中并逐字运行它——运行只花了 1 秒。

我运行了一个更大的数据集,在 Levey-Jennings 应用程序中运行需要 60 秒 - 然而,在 TOAD 中,需要 10 秒。

这是查询的问题吗?还是使用 executeQuery() 通常是极度放缓?

I inherited a...well, I guess I can call it a piece-of-#### Struts application, and am tasked with optimizing a Levey-Jennings process that checks if our quality control standards are up to snuff.

The process itself runs fine, but there has always been a huge spike in performance time even if the dataset is small. I tested time between each part of the algorithm and discovered that the big time hog was Java's executeQuery() method.

Most recently I ran the application and logged the execution time to be 10 seconds. The executeQuery() took six of those seconds by itself. Curious to see what the problem was, I took the query into TOAD and ran it verbatim -- it only took 1 second to run.

I ran an even larger dataset, which took 60 seconds to run in the Levey-Jennings application -- however, in TOAD, it took 10.

Is this a problem with the query at all, or is using executeQuery() typically a precursor to extreme slowdown?

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

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

发布评论

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

评论(1

蓝咒 2024-11-09 10:28:57

当您在 TOAD(或任何其他 IDE)中运行查询时,此工具希望尽快为您提供您可以看到的结果。通常,它们会向您显示一个包含 10 或 40 行的网格。为了尽快向您显示前 10-40 行,它们会提示查询或更改优化环境以尽快生成前几行。

您可以在此处查看有关 FIRST_ROWS 提示的更多信息: http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements006.htm#SQLRF50302

应用程序中的查询可能不使用 FIRST_ROWS 提示。它希望尽可能快地获取所有行。它并不关心第一行是否立即显示。因此,这两个查询的优化环境是不同的。

TOAD 显示生成第一行所花费的时间也没有帮助,因为它会让您认为这就是获取所有行所花费的时间。不过,有一个选项可以导航到最后一行。按下它,您会发现现在需要更长的时间。

希望这有帮助。

问候,
抢。

When you run a query in TOAD (or any other IDE), this tool wants to provide you with the results you can see, as fast as possible. Typically they show you a grid with between 10 or 40 rows. To show you those first 10-40 rows as fast as possible, they hint the query or change the optimizing environment to produce those first rows as fast as possible.

Here you can see more information about the FIRST_ROWS hint: http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements006.htm#SQLRF50302

The query in your application likely doesn't use a FIRST_ROWS hint. It wants ALL the rows as fast as possible. It doesn't care if the first row shows up immediately. So, the optimizing environment for those two queries is different.

It also doesn't help that TOAD displays the time it took to produce the first rows, because it leads you to think that that's the time it takes to get all the rows. There is an option to navigate to the last row, though. Press that and you'll see that it now takes longer.

Hope this helps.

Regards,
Rob.

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