Non, c'est grâce à l'optimalisation de "count".
(cursor_sharing=EXACT)Code:
1
2
3
4 select count (a) from t1 where x <= 501; select count (x) from t1 where x <= 502; select count (1) from t1 where x <= 503; select count (b) from t1 where x <= 504;
Version imprimable
tu peux essayer avec un count(d) pour voir ?
Code:
1
2
3
4
5
6
7
8
9
10
11 select count (b) from t1 where x <= 504; -------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 4 | 2 (0)| 00:00:01 | | 1 | SORT AGGREGATE | | 1 | 4 | | | |* 2 | INDEX RANGE SCAN| T1X | 504 | 2016 | 2 (0)| 00:00:01 | -------------------------------------------------------------------------- 2 - access("X"<=504)
Code:
1
2
3
4
5
6
7
8
9
10
11
12 select count (d) from t1 where x <= 504; ------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 4005 | 507 (0)| 00:00:07 | | 1 | SORT AGGREGATE | | 1 | 4005 | | | | 2 | TABLE ACCESS BY INDEX ROWID| T1 | 504 | 1971K| 507 (0)| 00:00:07 | |* 3 | INDEX RANGE SCAN | T1X | 504 | | 2 (0)| 00:00:01 | ------------------------------------------------------------------------------------- 3 - access("X"<=504)
Code:
1
2
3
4
5
6
7
8
9
10
11 select count (d) from t1 where x <= 5000; --------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | --------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 4005 | 4400 (1)| 00:00:53 | | 1 | SORT AGGREGATE | | 1 | 4005 | | | |* 2 | TABLE ACCESS FULL| T1 | 5000 | 19M| 4400 (1)| 00:00:53 | --------------------------------------------------------------------------- 2 - filter("X"<=5000)
pour info : http://asktom.oracle.com/pls/asktom/...:1156151916789 :)