11G以前ORACLE处理带有绑定变量的SQL存在一些问题,产生出的执行计划不是对所有值都好,取决于第一次硬解析时窥探的值,11GR1版本推出了adaptive cursor sharing,它主要的目的是提升对于带有绑定变量的SQL的执行计划性能。优化器在使用adaptive cursor sharing后,已经可以为一个带有绑定变量的SQL产生出多个执行计划。这个特性非常有用对于列上数据有倾斜,在列上收集了直方图的SQL。
并不需要特别的方式来配置adaptive cursor sharing,默认它就是启用的,当然你可以通过一些隐含参数来打开或关闭adaptive cursor sharing,后面简称ACS。ACS的出现也引入了一些新视图和新列。
两个新列在V$SQL视图里,IS_BIND_SENSITIVE 和 IS_BIND_AWARE,IS_BIND_SENSITIVE为Y的CURSOR,代表这个CURSOR被监控了,而IS_BIND_AWARE为Y的,代表这个CURSOR每次被执行都要计算它谓词的选择率然后根据选择率查看是否当前共享池中是否有满足要求的执行计划,如果有重用,如果没有,重新生成一个。
V$SQL_CS_HISTOGRAM视图,主要记录SQL处理的行数的直方图,处理的行数驱动着ACS发挥作用。直方图bucket_id 0-2在每次游标执行的时候字段count发生变化,每一个bucket代表着操作的数据量,在11.2.0.3版本,当返回的行数在0-1000时候,将会在bucket_id 为0的桶,1000-1000000,将会在bucket_id为1的桶,多余1000000,将会在bucket_id为2的桶,请读者不要死记数字,各个版本可能不同。
V$SQL_CS_SELECTIVITY,记录游标谓词的选择率范围,最大值,最小值。
V$SQL_CS_STATISTICS 记录游标处理的行数、buffer gets等信息
SQL命令的CURSOR首先会被标注为IS_BIND_SENSITIVE='Y',在后面的执行过程中会决定是否这个CURSOR是bind aware的。
我们先来看一个测试示例。
CREATE TABLE test
AS
SELECT ROWNUM id,
DBMS_RANDOM.STRING('A', 12) name,
DECODE(MOD(ROWNUM, 500), 0, 'Inactive', 'Active') status
FROM all_objects
WHERE ROWNUM <= 50000;
CREATE INDEX test_id_ind ON test(status);
EXEC dbms_stats.gather_table_stats(user, 'test', method_opt => 'for columns status size 254', cascade => true);
SELECT COUNT (*) cnt, status
FROM test
GROUP BY status
/
CNT STATUS
---------- ----------------
14820 Active
29 Inactive
test@DLSP>var a varchar2(100)
test@DLSP>exec :a :='Inactive';
PL/SQL procedure successfully completed.
test@DLSP>select /*+ find_me */ count(name) from test where status=:a;
COUNT(NAME)
-----------
29
1 row selected.
test@DLSP>@findsql
Enter value for sql_text: %find_me%
Enter value for sql_id:
SQL_ID CHILD PLAN_HASH EXECS AVG_ETIME AVG_LIO SQL_TEXT
-------------------------- ------ ---------- ---------- ------------- ------------ ------------------------------------------------------------
a9cf9a1ky3bda 0 1950795681 1 .03 2,014 select /*+ find_me */ count(name) from test where status=:a
--------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 4 (100)| |
| 1 | SORT AGGREGATE | | 1 | 21 | | |
| 2 | TABLE ACCESS BY INDEX ROWID| TEST | 29 | 609 | 4 (0)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | TEST_ID_IND | 29 | | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------------------------
test@DLSP> -- Check ACS status
test@DLSP> SELECT child_number, executions, buffer_gets, is_bind_sensitive,
2 is_bind_aware
3 FROM v$sql
4 WHERE sql_id='a9cf9a1ky3bda';
CHILD EXECUTIONS BUFFER_GETS IS IS
------ ---------- ----------- -- --
0 1 32 Y N
1 row selected.
test@DLSP>-- Histogram
test@DLSP> SELECT hash_value, sql_id, child_number, bucket_id, COUNT
2 FROM v$sql_cs_histogram
3 WHERE sql_id='a9cf9a1ky3bda'
4 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD BUCKET_ID COUNT
---------- -------------------------- ------ ---------- ----------
1709288874 a9cf9a1ky3bda 0 0 1
1709288874 a9cf9a1ky3bda 0 2 0
1709288874 a9cf9a1ky3bda 0 1 0
3 rows selected.
test@DLSP>-- Statistics
test@DLSP> SELECT hash_value, sql_id, child_number, bind_set_hash_value, executions,
2 rows_processed, buffer_gets, cpu_time
3 FROM v$sql_cs_statistics
4 WHERE sql_id='a9cf9a1ky3bda'
5 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD BIND_SET_HASH_VALUE EXECUTIONS ROWS_PROCESSED BUFFER_GETS CPU_TIME
---------- -------------------------- ------ ------------------- ---------- -------------- ----------- ----------
1709288874 a9cf9a1ky3bda 0 2588756875 1 59 32 0
1 row selected.
test@DLSP>-- Selectivity
test@DLSP> SELECT hash_value, sql_id, child_number, predicate, range_id, low, high
2 FROM v$sql_cs_selectivity
3 WHERE sql_id='a9cf9a1ky3bda'
4 ORDER BY sql_id, child_number;
no rows selected
优化器参考直方图信息后,使用了索引扫描INDEX RANGE SCAN,这是一个正确的决定,注意v$sql的输出和其他V$视图的输出,ORACLE已经标注此SQL为“IS_BIND_SENSITIVE = Y”。
test@DLSP>exec :a :='Active'
PL/SQL procedure successfully completed.
test@DLSP>select /*+ find_me */ count(name) from test where status=:a;
COUNT(NAME)
-----------
475456
1 row selected.
test@DLSP>select * from table(dbms_xplan.display_cursor('a9cf9a1ky3bda',null));
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID a9cf9a1ky3bda, child number 0
-------------------------------------
select /*+ find_me */ count(name) from test where status=:a
Plan hash value: 2948918962
--------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 4 (100)| |
| 1 | SORT AGGREGATE | | 1 | 21 | | |
| 2 | TABLE ACCESS BY INDEX ROWID| TEST | 29 | 609 | 4 (0)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | TEST_ID_IND | 29 | | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
3 - access("STATUS"=:A)
test@DLSP> -- Check ACS status
test@DLSP> SELECT child_number, executions, buffer_gets, is_bind_sensitive,
2 is_bind_aware
3 FROM v$sql
4 WHERE sql_id='a9cf9a1ky3bda';
CHILD EXECUTIONS BUFFER_GETS IS IS
------ ---------- ----------- -- --
0 2 3889 Y N
1 row selected.
test@DLSP>
test@DLSP>
test@DLSP>-- Histogram
test@DLSP> SELECT hash_value, sql_id, child_number, bucket_id, COUNT
2 FROM v$sql_cs_histogram
3 WHERE sql_id='a9cf9a1ky3bda'
4 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD BUCKET_ID COUNT
---------- -------------------------- ------ ---------- ----------
1709288874 a9cf9a1ky3bda 0 0 1
1709288874 a9cf9a1ky3bda 0 2 0
1709288874 a9cf9a1ky3bda 0 1 1
3 rows selected.
test@DLSP>
test@DLSP>
test@DLSP>-- Statistics
test@DLSP> SELECT hash_value, sql_id, child_number, bind_set_hash_value, executions,
2 rows_processed, buffer_gets, cpu_time
3 FROM v$sql_cs_statistics
4 WHERE sql_id='a9cf9a1ky3bda'
5 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD BIND_SET_HASH_VALUE EXECUTIONS ROWS_PROCESSED BUFFER_GETS CPU_TIME
---------- -------------------------- ------ ------------------- ---------- -------------- ----------- ----------
1709288874 a9cf9a1ky3bda 0 2588756875 1 59 32 0
1 row selected.
test@DLSP>
test@DLSP>
test@DLSP>
test@DLSP>-- Selectivity
test@DLSP> SELECT hash_value, sql_id, child_number, predicate, range_id, low, high
2 FROM v$sql_cs_selectivity
3 WHERE sql_id='a9cf9a1ky3bda'
4 ORDER BY sql_id, child_number;
no rows selected
我们看到优化器采用了跟status='Inactive'一样的执行计划,这个执行计划是很糟糕的,因为status为Inactive的只有29个,而status为Active的有475456个,表里的大部分数据都是status为Active的。但是你是否注意到两次v$sql_cs_histogram的输出差异。第一次输出的值,bucket_id为0的count为1,第二次输出的值,bucket_id为0的保持不变,bucket_id为1的的count为1,这代表了优化器已经意识到了这个SQL的返回的行数跟第一次已经大大的不同了。
HASH_VALUE SQL_ID CHILD BUCKET_ID COUNT
---------- -------------------------- ------ ---------- ----------
1709288874 a9cf9a1ky3bda 0 0 1
1709288874 a9cf9a1ky3bda 0 2 0
1709288874 a9cf9a1ky3bda 0 1 0
HASH_VALUE SQL_ID CHILD BUCKET_ID COUNT
---------- -------------------------- ------ ---------- ----------
1709288874 a9cf9a1ky3bda 0 0 1
1709288874 a9cf9a1ky3bda 0 2 0
1709288874 a9cf9a1ky3bda 0 1 1
test@DLSP>exec :a :='Active'
PL/SQL procedure successfully completed.
test@DLSP>select /*+ find_me */ count(name) from test where status=:a;
COUNT(NAME)
-----------
475456
select * from table(dbms_xplan.display_cursor('a9cf9a1ky3bda',null));
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID a9cf9a1ky3bda, child number 0
-------------------------------------
select /*+ find_me */ count(name) from test where status=:a
Plan hash value: 2948918962
--------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 4 (100)| |
| 1 | SORT AGGREGATE | | 1 | 21 | | |
| 2 | TABLE ACCESS BY INDEX ROWID| TEST | 29 | 609 | 4 (0)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | TEST_ID_IND | 29 | | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
3 - access("STATUS"=:A)
SQL_ID a9cf9a1ky3bda, child number 1
-------------------------------------
select /*+ find_me */ count(name) from test where status=:a
Plan hash value: 1950795681
---------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 452 (100)| |
| 1 | SORT AGGREGATE | | 1 | 21 | | |
|* 2 | TABLE ACCESS FULL| TEST | 475K| 9750K| 452 (3)| 00:00:06 |
---------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("STATUS"=:A)
test@DLSP> -- Check ACS status
test@DLSP> SELECT child_number, executions, buffer_gets, is_bind_sensitive,
2 is_bind_aware
3 FROM v$sql
4 WHERE sql_id='a9cf9a1ky3bda';
CHILD_NUMBER EXECUTIONS BUFFER_GETS IS IS
------------ ---------- ----------- -- --
0 2 3889 Y N
1 1 1969 Y Y
test@DLSP>
test@DLSP>
test@DLSP>-- Histogram
test@DLSP> SELECT hash_value, sql_id, child_number, bucket_id, COUNT
2 FROM v$sql_cs_histogram
3 WHERE sql_id='a9cf9a1ky3bda'
4 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD_NUMBER BUCKET_ID COUNT
---------- -------------------------- ------------ ---------- ----------
1709288874 a9cf9a1ky3bda 0 1 1
1709288874 a9cf9a1ky3bda 0 0 1
1709288874 a9cf9a1ky3bda 0 2 0
1709288874 a9cf9a1ky3bda 1 1 1
1709288874 a9cf9a1ky3bda 1 0 0
1709288874 a9cf9a1ky3bda 1 2 0
6 rows selected.
test@DLSP>
test@DLSP>
test@DLSP>-- Statistics
test@DLSP> SELECT hash_value, sql_id, child_number, bind_set_hash_value, executions,
2 rows_processed, buffer_gets, cpu_time
3 FROM v$sql_cs_statistics
4 WHERE sql_id='a9cf9a1ky3bda'
5 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD_NUMBER BIND_SET_HASH_VALUE EXECUTIONS ROWS_PROCESSED BUFFER_GETS CPU_TIME
---------- -------------------------- ------------ ------------------- ---------- -------------- ----------- ----------
1709288874 a9cf9a1ky3bda 0 2588756875 1 59 32 0
1709288874 a9cf9a1ky3bda 1 2944692738 1 475457 1969 0
test@DLSP>
test@DLSP>
test@DLSP>
test@DLSP>-- Selectivity
test@DLSP> SELECT hash_value, sql_id, child_number, predicate, range_id, low, high
2 FROM v$sql_cs_selectivity
3 WHERE sql_id='a9cf9a1ky3bda'
4 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD_NUMBER PREDICATE RANGE_ID LOW HIGH
---------- -------------------------- ------------ --------------- ---------- -------------------- --------------------
1709288874 a9cf9a1ky3bda 1 =A 0 0.899945 1.099933
优化器终于代替了index range scan的执行计划,采用了full table scan。 V$SQL已经产生了新游标,IS_BIND_AWARE的值也已经变成了Y, 视图v$SQL_CS_HISTOGRAM额外的多了3行,为了记录在status为Active时候的执行计划信息。视图V$SQL_CS_STATISTICS也新增了一行记录新游标的行处理信息和buffer gets信息。$SQL_CS_SELECTIVITY记录了新游标谓词的选择率。
截止到目前,这个SQL已经是bind aware的了。
test@DLSP>var a varchar2(100)
test@DLSP>exec :a :='Inactive'
PL/SQL procedure successfully completed.
test@DLSP>select /*+ find_me */ count(name) from test where status=:a;
COUNT(NAME)
-----------
29
test@DLSP>col PREDICATE for a15
test@DLSP> -- Check ACS status
test@DLSP> SELECT child_number, executions, buffer_gets, is_bind_sensitive,
2 is_bind_aware
3 FROM v$sql
4 WHERE sql_id='a9cf9a1ky3bda';
CHILD_NUMBER EXECUTIONS BUFFER_GETS IS IS
------------ ---------- ----------- -- --
0 2 3889 Y N
1 1 1969 Y Y
2 1 32 Y Y
test@DLSP>
test@DLSP>
test@DLSP>-- Histogram
test@DLSP> SELECT hash_value, sql_id, child_number, bucket_id, COUNT
2 FROM v$sql_cs_histogram
3 WHERE sql_id='a9cf9a1ky3bda'
4 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD_NUMBER BUCKET_ID COUNT
---------- -------------------------- ------------ ---------- ----------
1709288874 a9cf9a1ky3bda 0 1 1
1709288874 a9cf9a1ky3bda 0 0 1
1709288874 a9cf9a1ky3bda 0 2 0
1709288874 a9cf9a1ky3bda 1 0 0
1709288874 a9cf9a1ky3bda 1 1 1
1709288874 a9cf9a1ky3bda 1 2 0
1709288874 a9cf9a1ky3bda 2 1 0
1709288874 a9cf9a1ky3bda 2 0 1
1709288874 a9cf9a1ky3bda 2 2 0
9 rows selected.
test@DLSP>
test@DLSP>
test@DLSP>-- Statistics
test@DLSP> SELECT hash_value, sql_id, child_number, bind_set_hash_value, executions,
2 rows_processed, buffer_gets, cpu_time
3 FROM v$sql_cs_statistics
4 WHERE sql_id='a9cf9a1ky3bda'
5 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD_NUMBER BIND_SET_HASH_VALUE EXECUTIONS ROWS_PROCESSED BUFFER_GETS CPU_TIME
---------- -------------------------- ------------ ------------------- ---------- -------------- ----------- ----------
1709288874 a9cf9a1ky3bda 0 2588756875 1 59 32 0
1709288874 a9cf9a1ky3bda 1 2944692738 1 475457 1969 0
1709288874 a9cf9a1ky3bda 2 2588756875 1 59 32 0
test@DLSP>
test@DLSP>
test@DLSP>
test@DLSP>-- Selectivity
test@DLSP> SELECT hash_value, sql_id, child_number, predicate, range_id, low, high
2 FROM v$sql_cs_selectivity
3 WHERE sql_id='a9cf9a1ky3bda'
4 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD_NUMBER PREDICATE RANGE_ID LOW HIGH
---------- -------------------------- ------------ --------------- ---------- -------------------- --------------------
1709288874 a9cf9a1ky3bda 1 =A 0 0.899945 1.099933
1709288874 a9cf9a1ky3bda 2 =A 0 0.000054 0.000066
由于这个SQL已经是bind aware的了,当再次执行status='Inactive'时,ORACLE参考直方图信息后,重新产生了一个新的游标,这个游标的is_bind_aware字段为'Y',产生了index range scan的执行计划,非常棒!视图v$sql_cs_histogram,v$sql_cs_statistics,v$sql_cs_selectivity也都有相应的变化。
如何关闭ACS的特性:
alter system set "_optimizer_extended_cursor_sharing_rel"=none scope=both;
如果你的系统关闭了绑定变量窥探的功能也会自动关闭ACS。
alter system set "_optim_peek_user_binds"=false scope=both;
直方图与ACS
test@DLSP>begin
2 dbms_stats.delete_column_stats(ownname => 'test',
3 tabname => 'test',
4 colname => 'status',
5 col_stat_type => 'HISTOGRAM');
6 end;
7 /
PL/SQL procedure successfully completed.
test@DLSP>ALTER SYSTEM FLUSH SHARED_POOL;
System altered.
test@DLSP>exec :a :='Inactive'
PL/SQL procedure successfully completed.
test@DLSP>select /*+ find_me */ count(name) from test where status=:a;
COUNT(NAME)
-----------
29
test@DLSP>exec :a:='Active'
PL/SQL procedure successfully completed.
test@DLSP>select /*+ find_me */ count(name) from test where status=:a;
COUNT(NAME)
-----------
475456
test@DLSP>select /*+ find_me */ count(name) from test where status=:a;
COUNT(NAME)
-----------
475456
test@DLSP>select /*+ find_me */ count(name) from test where status=:a;
COUNT(NAME)
-----------
475456
test@DLSP>select /*+ find_me */ count(name) from test where status=:a;
COUNT(NAME)
-----------
475456
test@DLSP>select * from table(dbms_xplan.display_cursor('a9cf9a1ky3bda',null));
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID a9cf9a1ky3bda, child number 0
-------------------------------------
select /*+ find_me */ count(name) from test where status=:a
Plan hash value: 1950795681
---------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 452 (100)| |
| 1 | SORT AGGREGATE | | 1 | 21 | | |
|* 2 | TABLE ACCESS FULL| TEST | 237K| 4875K| 452 (3)| 00:00:06 |
---------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("STATUS"=:A)
SQL_ID a9cf9a1ky3bda, child number 1
-------------------------------------
select /*+ find_me */ count(name) from test where status=:a
Plan hash value: 1950795681
---------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 452 (100)| |
| 1 | SORT AGGREGATE | | 1 | 21 | | |
|* 2 | TABLE ACCESS FULL| TEST | 237K| 4875K| 452 (3)| 00:00:06 |
---------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("STATUS"=:A)
38 rows selected.
test@DLSP>col PREDICATE for a15
test@DLSP> -- Check ACS status
test@DLSP> SELECT child_number, executions, buffer_gets, is_bind_sensitive,
2 is_bind_aware
3 FROM v$sql
4 WHERE sql_id='a9cf9a1ky3bda';
CHILD_NUMBER EXECUTIONS BUFFER_GETS IS IS
------------ ---------- ----------- -- --
0 2 3983 Y N
1 3 5907 Y Y
test@DLSP>
test@DLSP>
test@DLSP>-- Histogram
test@DLSP> SELECT hash_value, sql_id, child_number, bucket_id, COUNT
2 FROM v$sql_cs_histogram
3 WHERE sql_id='a9cf9a1ky3bda'
4 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD_NUMBER BUCKET_ID COUNT
---------- -------------------------- ------------ ---------- ----------
1709288874 a9cf9a1ky3bda 0 1 1
1709288874 a9cf9a1ky3bda 0 0 1
1709288874 a9cf9a1ky3bda 0 2 0
1709288874 a9cf9a1ky3bda 1 1 3
1709288874 a9cf9a1ky3bda 1 0 0
1709288874 a9cf9a1ky3bda 1 2 0
6 rows selected.
test@DLSP>
test@DLSP>
test@DLSP>-- Statistics
test@DLSP> SELECT hash_value, sql_id, child_number, bind_set_hash_value, executions,
2 rows_processed, buffer_gets, cpu_time
3 FROM v$sql_cs_statistics
4 WHERE sql_id='a9cf9a1ky3bda'
5 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD_NUMBER BIND_SET_HASH_VALUE EXECUTIONS ROWS_PROCESSED BUFFER_GETS CPU_TIME
---------- -------------------------- ------------ ------------------- ---------- -------------- ----------- ----------
1709288874 a9cf9a1ky3bda 0 2588756875 1 30 2014 0
1709288874 a9cf9a1ky3bda 1 2944692738 1 475457 1969 0
test@DLSP>
test@DLSP>
test@DLSP>
test@DLSP>-- Selectivity
test@DLSP> SELECT hash_value, sql_id, child_number, predicate, range_id, low, high
2 FROM v$sql_cs_selectivity
3 WHERE sql_id='a9cf9a1ky3bda'
4 ORDER BY sql_id, child_number;
HASH_VALUE SQL_ID CHILD_NUMBER PREDICATE RANGE_ID LOW HIGH
---------- -------------------------- ------------ --------------- ---------- -------------------- --------------------
1709288874 a9cf9a1ky3bda 1 =A 0 0.450000 0.550000
我们可以看到虽然优化器识别到了这个SQL是bind aware的,但是由于缺少直方图信息,不能产生执行计划为index range scan的执行计划了。因此使用ACS的功能一定要结合直方图一起使用。
bind_aware的用法和作用
使用了ACS的功能后,一个游标从bind sensitive 大 bind aware,中间有着不稳定器,如果在游标中使用bind_aware hint后,将会使游标的状态直接进入bind aware,而不会经历bind sensitive状态。我们来通过一个例子看一看:
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22034023/viewspace-1218980/
,如需转载,请注明出处,否则将追究法律责任。