本文介绍了如何使用DB2 Explain?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 如何使用DB2的Explain函数? - 运行它,并使用它来优化查询。 DB2有更好的工具吗?How do I use DB2's Explain function? -- both to run it, and to use it to optimize queries. Is there a better tool available for DB2?我之前已经建立了查询,但是我不得不告诉他们要花多长时间才能运行它们,并且花费时间理想的。I've built queries before, but the only way I've had to tell how long they'd take is to run them and time them -- which is hardly ideal.编辑:对我来说,答案是你不能,你没有,无法访问。你不喜欢官僚主义吗?The answer for me turned out to be "You can't. You don't have and cannot get the access." Don't you love bureaucracy?推荐答案您正在寻找的内容由两个DB2实用程序覆盖:What you're looking for is covered by two DB2 utilities: explain utility ,其中显示了优化程序的访问计划和特定查询的估计成本(基于当前的RUNSTATS统计信息) 设计顾问,其建议进行结构更改以改善一个或多个查询的性能The explain utility, which shows the optimizer's access plan and estimated cost for a specific query (based on current RUNSTATS statistics)The design advisor, which recommends structural changes to improve the performance of one or more queries这两个实用程序都需要专门的表将在数据库中创建。Both utilities require specialized tables to be created in the database.我倾向于使用explain实用程序而不是顾问,特别是如果我能够更改查询的SQL以影响更好的访问计划。我使用db2expln命令行实用程序来解释不同版本的查询,我正在调整并比较其成本。最重要的是,您的表和索引统计信息在运行说明或设计顾问时是最新的。I tend to use the explain utility more than the advisor, especially if I am able to change the SQL for the query to influence a better access plan. I use the db2expln command-line utility to explain different versions of a query I'm tuning and compare their costs. What's most important is that your table and index statistics are up to date when running explain or the design advisor. 这篇关于如何使用DB2 Explain?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-04 13:30