命令Analyze table tbl compute statistics
是DDL还是DML?直觉上,它似乎都不是。
当我在.sql文件中有这个命令时,我需要这样做:
execute immediate 'Analyze table tbl compute statistics'
我对该命令有一个熟悉的问题:GRANT DELETE, INSERT, SELECT, UPDATE ON tbl to user
答案 0 :(得分:6)
更新 Oracle says,grant
和analyze
都是数据定义语言(DDL)语句。他们显然没有区分DDL和数据控制语言(DCL)。
如果在PL / SQL中执行,则需要execute immediate
或DBMS_SQL。
此外,“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
已弃用以收集优化程序统计信息,但对其他内容仍然有用。请改用DBMS_STATS。 (我链接到10g R2的在线Oracle文档。但是过去几天我在Oracle的文档站点遇到了麻烦,10g R2文档消失然后再次出现。)