在其他数据库中解释 SELECT
我发现EXPLAIN SELECT查询在MySQL中非常有用,因为它提供了有关如何执行SQL的信息,并提供了分析的机会,例如,您应该添加缺失的索引,以便在执行查询之前提高响应本身并分析统计数据。
我的问题是:在 MS Sql、Firebird、Ingres 等数据库中,是否有类似的命令可用?
在 Firebird 中,我们有 PLAN,但它非常弱,因为很多时候必须运行很长的查询才能按顺序运行查看一个简单的错误。
谨致问候,
毛罗·H·莱吉里
I found EXPLAIN SELECT query very useful in MySQL because it gives information on how SQL will be executed and gives the opportunity to analyze, for e.g., missing indexes you should add in order to improve response BEFORE doing the query itself and analyzing stats.
My question is: In databases like MS Sql, Firebird, Ingres, is there a similar command available?
In Firebird we have PLAN, but is very weak because many times one has to run very long queries in order to view a simple mistake.
Best regards,
Mauro H. Leggieri
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
在
Oracle
中:在
PostgreSQL
中:在
SQL Server
中:In
Oracle
:In
PostgreSQL
:In
SQL Server
:对于 mssql 服务器,您可以使用
这将阻止查询实际执行,但它将返回查询计划。
对于oracle,你可以使用
(我不知道firebird或ingres)
For mssql server you can use
this will prevent queries from actually being exectued but it will return they query plan.
For oracle you can use
(I don't know about firebird or ingres)
在Oracle中,我们有
http://www.adp-gmbh .ch/ora/explainplan.html
在 MS SQL Server 中,您可以获得文本或 XML 版本的执行计划。
然而,最好使用 Sql Server Management Studio/TOAD 中的可视化工具查看这些内容。
http://msdn.microsoft.com/en-us/library/ms176058。 aspx
其他非常方便的东西是
In Oracle we have
http://www.adp-gmbh.ch/ora/explainplan.html
In MS SQL Server you can get an text or XML version of the execution plan.
However these are best viewed using the visual tool in Sql Server Management Studio/TOAD.
http://msdn.microsoft.com/en-us/library/ms176058.aspx
Something else that is quite handy is
对于 Ingres,以下内容将为您提供最终选择的计划,以及对行数、磁盘 IO 和 CPU 周期的估计:
要获取计划但不执行 SELECT,还需要添加
重新启用查询执行:
以获取实际统计信息对于执行的查询,与“set qep”的输出进行比较:
请参阅 http://docs.ingres.com/Ingres/9.2/SQL%20Reference%20Guide/set.htm 了解有关上述内容的更多信息。
For Ingres, the following will give you the final plan chosen with estimates as to the number of rows, disk IOs and CPU cycles:
To get the plan but not execute the SELECT also add
re-enable query execution:
to get the the actual statistics for the executed query, to compare with the output from "set qep":
See http://docs.ingres.com/Ingres/9.2/SQL%20Reference%20Guide/set.htm for more information on the above.
MS SQL 在 Management Studio 中有一个实用程序,称为在执行查询时显示执行计划(估计的和精确的)。它还可以显示查询的统计信息(运行时间、行数、流量等)
MS SQL has a utility in Management Studio called Display Execution Plan (Estimated and Exact) when executing a query. it can also display statistics for the query (run time, number of rows, traffic etc )
对于 Ingres,另请参阅以下资源:
阅读和解释 a 的示例查询执行计划 (QEP) [pdf]
一个简短的案例研究,演示 QEP 的分析和解释
使用 JDBC 获取 Ingres Qep LockTrace
查询执行计划(QEP)
For Ingres, see also these resources:
Example of Reading and Interpreting a Query Execution Plan (QEP) [pdf]
A brief case study that demonstrates analysis and interpretation of a QEP
Getting Ingres Qep LockTrace Using JDBC
The Query Execution Plan (QEP)