Oracle 分析表命令
命令Analyze table tblcomputestatistics
是DDL还是DML?直觉上,似乎两者都不是。 当我在 .sql 文件中有这个命令时,我需要做什么:
execute immediate 'Analyze table tbl compute statistics'
我对这个命令有一个类似的问题:GRANT DELETE, INSERT, SELECT, UPDATE ON tbl to user
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 :
execute immediate 'Analyze table tbl compute statistics'
I have a smiliar question about the command: GRANT DELETE, INSERT, SELECT, UPDATE ON tbl to user
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新 Oracle 说< /a>
grant
和analyze
都是数据定义语言 (DDL) 语句。他们显然没有区分 DDL 和数据控制语言 (DCL)。如果从 PL/SQL 中执行,则
立即执行
或DBMS_SQL 是需要的。另外,“不要使用 COMPUTE 和 ESTIMATE 子句ANALYZE 来收集优化器统计信息。" (10gR2) "要收集大多数统计信息,请使用 DBMS_STATS
包裹。 ...使用 ANALYZE 语句(而不是 DBMS_STATS)
用于与基于成本的统计无关的统计收集
优化器。” (11g R2)
分析表
已被弃用,用于收集优化器统计信息,但对于其他事情仍然有用。使用 DBMS_STATS 代替。 (我链接到了 10g R2 的在线 Oracle 文档。但是,最近几天我在 Oracle 文档网站上遇到了问题,10g R2 文档消失然后又出现。)UPDATE Oracle says that both
grant
andanalyze
are Data Definition Language (DDL) statements. They apparently do not make a distinction between DDL and Data Control Language (DCL).If executing from within PL/SQL, then either
execute immediate
or DBMS_SQL would be needed.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_STATS instead. (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.)