Oracle 分析表命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7854413/
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
Oracle Analyze Table command
提问by Victor
Is the command Analyze table tbl compute statistics
a DDL or DML? Intuitively, it seems to be neither.
When i have this command in a .sql file do i need to do :
命令Analyze table tbl compute statistics
是 DDL 还是 DML?直觉上,似乎两者都不是。当我在 .sql 文件中有此命令时,我需要执行以下操作:
execute immediate 'Analyze table tbl compute statistics'
I have a smiliar question about the command: GRANT DELETE, INSERT, SELECT, UPDATE ON tbl to user
我有一个关于命令的问题: GRANT DELETE, INSERT, SELECT, UPDATE ON tbl to user
回答by Shannon Severance
UPDATEOracle saysthat both grant
and analyze
are Data Definition Language (DDL) statements. They apparently do not make a distinction between DDL and Data Control Language (DCL).
UPDATE甲骨文说,这两个grant
和analyze
的数据定义语言(DDL)语句。他们显然没有区分 DDL 和数据控制语言 (DCL)。
If executing from within PL/SQL, then either execute immediate
or DBMS_SQLwould be needed.
如果从 PL/SQL 中执行,则需要DBMS_SQLexecute immediate
或DBMS_SQL。
Also, "Do not use the COMPUTE and ESTIMATE clauses of ANALYZE to collect optimizer statistics. " (10gR2) "For the collection of most statistics, use the DBMS_STATS
package. ... Use the ANALYZE statement (rather than DBMS_STATS)
for statistics collection not related to the cost-based
optimizer." (11g R2) Analyze table
is deprecated for gathering optimizer statistics, though still usefull for other things. Use DBMS_STATSinstead. (I linked to the online Oracle documentation for 10g R2. However I've been having trouble with Oracle's documenation site the last few days, with the 10g R2 documents disappearing and then reappearing.)
另外,“不要使用 ANALYZE 的 COMPUTE 和 ESTIMATE 子句来收集优化器统计信息。”(10gR2)“对于大多数统计信息的收集,请使用 DBMS_STATS 包。...使用 ANALYZE 语句(而不是 DBMS_STATS)进行统计信息收集与基于成本的优化器无关。” (11g R2)Analyze table
已弃用,用于收集优化器统计信息,但对其他方面仍然有用。请改用DBMS_STATS。(我链接到 10g R2 的在线 Oracle 文档。但是,最近几天我在 Oracle 的文档站点上遇到了问题,10g R2 文档消失了然后又重新出现。)