count 语句有使用索引吗
答案:1 悬赏:50 手机版
解决时间 2021-02-28 00:48
- 提问者网友:咪咪
- 2021-02-27 11:19
count 语句有使用索引吗
最佳答案
- 五星知识达人网友:从此江山别
- 2021-02-27 12:33
--分析表
SQL> analyze table emp compute statistics;
表已分析。
-- 再次执行 则开始走索引
SQL> select count(*) from emp;
Execution Plan
----------------------------------------------------------
0 SELECt STATEMENT Optimizer=CHOOSE (Cost=1 Card=1)
1 0 SORT (AGGREGATE)
2 1 INDEX (FULL SCAN) OF 'PK_EMP' (UNIQUE) (Cost=1 Card=14)
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
1 consistent gets
0 physical reads
0 redo size
376 bytes sent via SQL*Net to client
503 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
问题解决,但仍有许多需要解释一下的地方。
SQL> analyze table emp compute statistics;
表已分析。
-- 再次执行 则开始走索引
SQL> select count(*) from emp;
Execution Plan
----------------------------------------------------------
0 SELECt STATEMENT Optimizer=CHOOSE (Cost=1 Card=1)
1 0 SORT (AGGREGATE)
2 1 INDEX (FULL SCAN) OF 'PK_EMP' (UNIQUE) (Cost=1 Card=14)
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
1 consistent gets
0 physical reads
0 redo size
376 bytes sent via SQL*Net to client
503 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
问题解决,但仍有许多需要解释一下的地方。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯