Oracle 分析表命令

发布于 2024-12-11 07:03:55 字数 276 浏览 6 评论 0原文

命令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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我最亲爱的 2024-12-18 07:03:55

更新 Oracle 说< /a> grantanalyze 都是数据定义语言 (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 and analyze 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.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文