看一眼数据库负载 11.2.0.4 RAC,居然是监控系统占用资源最多,首当其冲的就是以下语句
select count(*) from V$LOCK where TYPE = 'TX' and REQUEST = 6;
很简单,检查当前有几个请求独占的锁
查询时间很长,其中出现了之前提到过的“合并连接卡迪森”
看看访问路径,过滤条件
-
SQL_ID b1na79hpa7k3p, child number 0
-
-------------------------------------
-
select count(*) from V$LOCK where TYPE = 'TX' and REQUEST = 6;
-
-
Plan hash value: 2384831130
-
-
---------------------------------------------------------------------------
-
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
-
---------------------------------------------------------------------------
-
| 0 | SELECT STATEMENT | | | | 1 (100)|
-
| 1 | SORT AGGREGATE | | 1 | 53 | |
-
|* 2 | HASH JOIN | | 1 | 53 | 0 (0)|
-
| 3 | MERGE JOIN CARTESIAN | | 1 | 41 | 0 (0)|
-
|* 4 | FIXED TABLE FULL | X$KSUSE | 1 | 19 | 0 (0)|
-
| 5 | BUFFER SORT | | 1 | 22 | 0 (0)|
-
|* 6 | FIXED TABLE FULL | X$KSQRS | 1 | 22 | 0 (0)|
-
| 7 | VIEW | GV$_LOCK | 10 | 120 | 0 (0)|
-
| 8 | UNION-ALL | | | | |
-
|* 9 | FILTER | | | | |
-
| 10 | VIEW | GV$_LOCK1 | 2 | 24 | 0 (0)|
-
| 11 | UNION-ALL | | | | |
-
|* 12 | FIXED TABLE FULL| X$KDNSSF | 1 | 64 | 0 (0)|
-
|* 13 | FIXED TABLE FULL| X$KSQEQ | 1 | 64 | 0 (0)|
-
|* 14 | FIXED TABLE FULL | X$KTADM | 1 | 64 | 0 (0)|
-
|* 15 | FIXED TABLE FULL | X$KTATRFIL | 1 | 64 | 0 (0)|
-
|* 16 | FIXED TABLE FULL | X$KTATRFSL | 1 | 64 | 0 (0)|
-
|* 17 | FIXED TABLE FULL | X$KTATL | 1 | 64 | 0 (0)|
-
|* 18 | FIXED TABLE FULL | X$KTSTUSC | 1 | 64 | 0 (0)|
-
|* 19 | FIXED TABLE FULL | X$KTSTUSS | 1 | 64 | 0 (0)|
-
|* 20 | FIXED TABLE FULL | X$KTSTUSG | 1 | 64 | 0 (0)|
-
|* 21 | FIXED TABLE FULL | X$KTCXB | 1 | 64 | 0 (0)|
-
---------------------------------------------------------------------------
-
-
Query Block Name / Object Alias (identified by operation id):
-
-------------------------------------------------------------
-
-
1 - SEL$AF73C875
-
4 - SEL$AF73C875 / S@SEL$4
-
6 - SEL$AF73C875 / R@SEL$4
-
7 - SET$1 / GV$_LOCK@SEL$5
-
8 - SET$1
-
9 - SEL$68B588A0
-
10 - SET$2 / GV$_LOCK1@SEL$7
-
11 - SET$2
-
12 - SEL$8 / X$KDNSSF@SEL$8
-
13 - SEL$9 / X$KSQEQ@SEL$9
-
14 - SEL$10 / X$KTADM@SEL$10
-
15 - SEL$11 / X$KTATRFIL@SEL$11
-
16 - SEL$12 / X$KTATRFSL@SEL$12
-
17 - SEL$13 / X$KTATL@SEL$13
-
18 - SEL$14 / X$KTSTUSC@SEL$14
-
19 - SEL$15 / X$KTSTUSS@SEL$15
-
20 - SEL$16 / X$KTSTUSG@SEL$16
-
21 - SEL$17 / X$KTCXB@SEL$17
-
-
Outline Data
-
-------------
-
-
/*+
-
BEGIN_OUTLINE_DATA
-
IGNORE_OPTIM_EMBEDDED_HINTS
-
OPTIMIZER_FEATURES_ENABLE('11.2.0.4')
-
DB_VERSION('11.2.0.4')
-
OPT_PARAM('_optim_peek_user_binds' 'false')
-
OPT_PARAM('_optimizer_extended_cursor_sharing' 'none')
-
OPT_PARAM('_gby_hash_aggregation_enabled' 'false')
-
OPT_PARAM('_optimizer_extended_cursor_sharing_rel' 'none')
-
OPT_PARAM('_optimizer_adaptive_cursor_sharing' 'false')
-
OPT_PARAM('_optimizer_use_feedback' 'false')
-
ALL_ROWS
-
OUTLINE_LEAF(@"SEL$8")
-
OUTLINE_LEAF(@"SEL$9")
-
OUTLINE_LEAF(@"SET$2")
-
OUTLINE_LEAF(@"SEL$68B588A0")
-
MERGE(@"SEL$7")
-
OUTLINE_LEAF(@"SEL$10")
-
OUTLINE_LEAF(@"SEL$11")
-
OUTLINE_LEAF(@"SEL$12")
-
OUTLINE_LEAF(@"SEL$13")
-
OUTLINE_LEAF(@"SEL$14")
-
OUTLINE_LEAF(@"SEL$15")
-
OUTLINE_LEAF(@"SEL$16")
-
OUTLINE_LEAF(@"SEL$17")
-
OUTLINE_LEAF(@"SET$1")
-
OUTLINE_LEAF(@"SEL$AF73C875")
-
MERGE(@"SEL$71D7A081")
-
OUTLINE(@"SEL$6")
-
OUTLINE(@"SEL$7")
-
OUTLINE(@"SEL$1")
-
OUTLINE(@"SEL$71D7A081")
-
MERGE(@"SEL$C8360722")
-
OUTLINE(@"SEL$2")
-
OUTLINE(@"SEL$C8360722")
-
MERGE(@"SEL$7286615E")
-
OUTLINE(@"SEL$3")
-
OUTLINE(@"SEL$7286615E")
-
MERGE(@"SEL$5")
-
OUTLINE(@"SEL$4")
-
OUTLINE(@"SEL$5")
-
FULL(@"SEL$AF73C875" "S"@"SEL$4")
-
FULL(@"SEL$AF73C875" "R"@"SEL$4")
-
NO_ACCESS(@"SEL$AF73C875" "GV$_LOCK"@"SEL$5")
-
LEADING(@"SEL$AF73C875" "S"@"SEL$4" "R"@"SEL$4" "GV$_LOCK"@"SEL$5")
-
USE_MERGE_CARTESIAN(@"SEL$AF73C875" "R"@"SEL$4")
-
USE_HASH(@"SEL$AF73C875" "GV$_LOCK"@"SEL$5")
-
FULL(@"SEL$17" "X$KTCXB"@"SEL$17")
-
FULL(@"SEL$16" "X$KTSTUSG"@"SEL$16")
-
FULL(@"SEL$15" "X$KTSTUSS"@"SEL$15")
-
FULL(@"SEL$14" "X$KTSTUSC"@"SEL$14")
-
FULL(@"SEL$13" "X$KTATL"@"SEL$13")
-
FULL(@"SEL$12" "X$KTATRFSL"@"SEL$12")
-
FULL(@"SEL$11" "X$KTATRFIL"@"SEL$11")
-
FULL(@"SEL$10" "X$KTADM"@"SEL$10")
-
NO_ACCESS(@"SEL$68B588A0" "GV$_LOCK1"@"SEL$7")
-
FULL(@"SEL$9" "X$KSQEQ"@"SEL$9")
-
FULL(@"SEL$8" "X$KDNSSF"@"SEL$8")
-
END_OUTLINE_DATA
-
*/
-
-
Predicate Information (identified by operation id):
-
---------------------------------------------------
-
-
2 - access("SADDR"="S"."ADDR" AND
-
TO_CHAR(USERENV('INSTANCE'))||RAWTOHEX("RADDR")=TO_CHAR("R"."INST_ID")||
-
RAWTOHEX("R"."ADDR"))
-
4 - filter("S"."INST_ID"=USERENV('INSTANCE'))
-
6 - filter("R"."KSQRSIDT"='TX')
-
9 - filter(USERENV('INSTANCE') IS NOT NULL)
-
12 - filter(("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0))
-
13 - filter(("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0))
-
14 - filter(("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0))
-
15 - filter(("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0))
-
16 - filter(("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0))
-
17 - filter(("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0))
-
18 - filter(("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0))
-
19 - filter(("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0))
-
20 - filter(("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0))
-
21 - filter(("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSPAFLG",1)<>0))
-
-
Column Projection Information (identified by operation id):
-
-----------------------------------------------------------
-
-
1 - (#keys=0) COUNT(*)[22]
-
2 - (#keys=2)
-
3 - "S"."ADDR"[RAW,8], "R"."ADDR"[RAW,8], "R"."INST_ID"[NUMBER,22]
-
4 - "S"."ADDR"[RAW,8], "S"."INST_ID"[NUMBER,22]
-
5 - (#keys=0) "R"."ADDR"[RAW,8], "R"."INST_ID"[NUMBER,22]
-
6 - "R"."ADDR"[RAW,8], "R"."INST_ID"[NUMBER,22],
-
"R"."KSQRSIDT"[VARCHAR2,2]
-
7 - "SADDR"[RAW,8], "RADDR"[RAW,8]
-
8 - STRDEF[8], STRDEF[8]
-
9 - "SADDR"[RAW,8], "RADDR"[RAW,8]
-
10 - "SADDR"[RAW,8], "RADDR"[RAW,8]
-
11 - STRDEF[8], STRDEF[8]
-
12 - "INST_ID"[NUMBER,22], "KSSOBFLG"[NUMBER,22], "KSQLKRES"[RAW,8],
-
"KSQLKMOD"[NUMBER,22], "KSQLKREQ"[NUMBER,22], "KSQLKSES"[RAW,8]
-
13 - "INST_ID"[NUMBER,22], "KSSOBFLG"[NUMBER,22], "KSQLKRES"[RAW,8],
-
"KSQLKMOD"[NUMBER,22], "KSQLKREQ"[NUMBER,22], "KSQLKSES"[RAW,8]
-
14 - "INST_ID"[NUMBER,22], "KSSOBFLG"[NUMBER,22], "KSQLKRES"[RAW,8],
-
"KSQLKMOD"[NUMBER,22], "KSQLKREQ"[NUMBER,22], "KSQLKSES"[RAW,8]
-
15 - "INST_ID"[NUMBER,22], "KSSOBFLG"[NUMBER,22], "KSQLKRES"[RAW,8],
-
"KSQLKMOD"[NUMBER,22], "KSQLKREQ"[NUMBER,22], "KSQLKSES"[RAW,8]
-
16 - "INST_ID"[NUMBER,22], "KSSOBFLG"[NUMBER,22], "KSQLKRES"[RAW,8],
-
"KSQLKMOD"[NUMBER,22], "KSQLKREQ"[NUMBER,22], "KSQLKSES"[RAW,8]
-
17 - "INST_ID"[NUMBER,22], "KSSOBFLG"[NUMBER,22], "KSQLKRES"[RAW,8],
-
"KSQLKMOD"[NUMBER,22], "KSQLKREQ"[NUMBER,22], "KSQLKSES"[RAW,8]
-
18 - "INST_ID"[NUMBER,22], "KSSOBFLG"[NUMBER,22], "KSQLKRES"[RAW,8],
-
"KSQLKMOD"[NUMBER,22], "KSQLKREQ"[NUMBER,22], "KSQLKSES"[RAW,8]
-
19 - "INST_ID"[NUMBER,22], "KSSOBFLG"[NUMBER,22], "KSQLKRES"[RAW,8],
-
"KSQLKMOD"[NUMBER,22], "KSQLKREQ"[NUMBER,22], "KSQLKSES"[RAW,8]
-
20 - "INST_ID"[NUMBER,22], "KSSOBFLG"[NUMBER,22], "KSQLKRES"[RAW,8],
-
"KSQLKMOD"[NUMBER,22], "KSQLKREQ"[NUMBER,22], "KSQLKSES"[RAW,8]
-
21 - "INST_ID"[NUMBER,22], "KSSPAFLG"[NUMBER,22], "KSQLKRES"[RAW,8],
-
"KSQLKMOD"[NUMBER,22], "KSQLKREQ"[NUMBER,22], "KSQLKSES"[RAW,8]
破解的办法就是加提示:ORDERED
说明:
如果从执行联接的SQL语句中没有ORDERED提示,那么优化器将选择联接表的顺序。如果您对优化器不知道的每个表中所选行的数量有所了解,则可能需要使用ORDERED提示来指定联接顺序。这样的信息可以让您比优化器更好地选择内部和外部表。
当SQL将大量表连接在一起(> 5)并且您知道应该始终按特定顺序连接表时,有序提示可能会极大地提高性能。
-
11:30:38 SYS@orcl1> SET AUTOT TRACE EXP STAT
-
11:30:46 SYS@orcl1> select /*+ RULE */ count(*) from V$LOCK where TYPE = 'TX' and REQUEST = 6;
-
Elapsed: 00:00:00.24
-
-
Execution Plan
-
----------------------------------------------------------
-
Plan hash value: 2026431807
-
-
-------------------------------------------------
-
| Id | Operation | Name |
-
-------------------------------------------------
-
| 0 | SELECT STATEMENT | |
-
| 1 | SORT AGGREGATE | |
-
| 2 | MERGE JOIN | |
-
| 3 | SORT JOIN | |
-
| 4 | MERGE JOIN | |
-
| 5 | SORT JOIN | |
-
|* 6 | FIXED TABLE FULL | X$KSQRS |
-
|* 7 | SORT JOIN | |
-
| 8 | VIEW | GV$_LOCK |
-
| 9 | UNION-ALL | |
-
|* 10 | FILTER | |
-
| 11 | VIEW | GV$_LOCK1 |
-
| 12 | UNION-ALL | |
-
|* 13 | FIXED TABLE FULL| X$KDNSSF |
-
|* 14 | FIXED TABLE FULL| X$KSQEQ |
-
|* 15 | FIXED TABLE FULL | X$KTADM |
-
|* 16 | FIXED TABLE FULL | X$KTATRFIL |
-
|* 17 | FIXED TABLE FULL | X$KTATRFSL |
-
|* 18 | FIXED TABLE FULL | X$KTATL |
-
|* 19 | FIXED TABLE FULL | X$KTSTUSC |
-
|* 20 | FIXED TABLE FULL | X$KTSTUSS |
-
|* 21 | FIXED TABLE FULL | X$KTSTUSG |
-
|* 22 | FIXED TABLE FULL | X$KTCXB |
-
|* 23 | SORT JOIN | |
-
|* 24 | FIXED TABLE FULL | X$KSUSE |
-
-------------------------------------------------
-
-
Predicate Information (identified by operation id):
-
---------------------------------------------------
-
-
6 - filter("R"."KSQRSIDT"='TX')
-
7 - access(TO_CHAR(USERENV('INSTANCE'))||RAWTOHEX("RADDR")=TO_CHAR("R
-
"."INST_ID")||RAWTOHEX("R"."ADDR"))
-
filter(TO_CHAR(USERENV('INSTANCE'))||RAWTOHEX("RADDR")=TO_CHAR("R
-
"."INST_ID")||RAWTOHEX("R"."ADDR"))
-
10 - filter(USERENV('INSTANCE')=USERENV('INSTANCE'))
-
13 - filter("KSQLKREQ"=6 AND "INST_ID"=USERENV('INSTANCE') AND
-
("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND BITAND("KSSOBFLG",1)<>0)
-
14 - filter("KSQLKREQ"=6 AND "INST_ID"=USERENV('INSTANCE') AND
-
("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND BITAND("KSSOBFLG",1)<>0)
-
15 - filter("INST_ID"=USERENV('INSTANCE') AND "KSQLKREQ"=6 AND
-
("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND BITAND("KSSOBFLG",1)<>0)
-
16 - filter("INST_ID"=USERENV('INSTANCE') AND "KSQLKREQ"=6 AND
-
("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND BITAND("KSSOBFLG",1)<>0)
-
17 - filter("INST_ID"=USERENV('INSTANCE') AND "KSQLKREQ"=6 AND
-
("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND BITAND("KSSOBFLG",1)<>0)
-
18 - filter("INST_ID"=USERENV('INSTANCE') AND "KSQLKREQ"=6 AND
-
("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND BITAND("KSSOBFLG",1)<>0)
-
19 - filter("INST_ID"=USERENV('INSTANCE') AND "KSQLKREQ"=6 AND
-
("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND BITAND("KSSOBFLG",1)<>0)
-
20 - filter("INST_ID"=USERENV('INSTANCE') AND "KSQLKREQ"=6 AND
-
("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND BITAND("KSSOBFLG",1)<>0)
-
21 - filter("INST_ID"=USERENV('INSTANCE') AND "KSQLKREQ"=6 AND
-
("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND BITAND("KSSOBFLG",1)<>0)
-
22 - filter("INST_ID"=USERENV('INSTANCE') AND "KSQLKREQ"=6 AND
-
("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND BITAND("KSSPAFLG",1)<>0)
-
23 - access("SADDR"="S"."ADDR")
-
filter("SADDR"="S"."ADDR")
-
24 - filter("S"."INST_ID"=USERENV('INSTANCE'))
-
-
Note
-
-----
-
- rule based optimizer used (consider using cbo)
-
-
-
Statistics
-
----------------------------------------------------------
-
0 recursive calls
-
1 db block gets
-
0 consistent gets
-
0 physical reads
-
0 redo size
-
596 bytes sent via SQL*Net to client
-
520 bytes received via SQL*Net from client
-
2 SQL*Net roundtrips to/from client
-
3 sorts (memory)
-
0 sorts (disk)
-
1 rows processed
-
-
11:30:48 SYS@orcl1>
-
11:31:24 SYS@orcl1>
-
11:31:25 SYS@orcl1> select /*+ ORDERED */count(*) from V$LOCK where TYPE = 'TX' and REQUEST = 6;
-
Elapsed: 00:00:00.21
-
-
Execution Plan
-
----------------------------------------------------------
-
Plan hash value: 3730480328
-
-
---------------------------------------------------------------------------------------
-
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-
---------------------------------------------------------------------------------------
-
| 0 | SELECT STATEMENT | | 1 | 53 | 1 (100)| 00:00:01 |
-
| 1 | SORT AGGREGATE | | 1 | 53 | | |
-
|* 2 | HASH JOIN | | 1 | 53 | 1 (100)| 00:00:01 |
-
|* 3 | HASH JOIN | | 1 | 31 | 0 (0)| 00:00:01 |
-
| 4 | VIEW | GV$_LOCK | 10 | 120 | 0 (0)| 00:00:01 |
-
| 5 | UNION-ALL | | | | | |
-
|* 6 | FILTER | | | | | |
-
| 7 | VIEW | GV$_LOCK1 | 2 | 24 | 0 (0)| 00:00:01 |
-
| 8 | UNION-ALL | | | | | |
-
|* 9 | FIXED TABLE FULL| X$KDNSSF | 1 | 64 | 0 (0)| 00:00:01 |
-
|* 10 | FIXED TABLE FULL| X$KSQEQ | 1 | 64 | 0 (0)| 00:00:01 |
-
|* 11 | FIXED TABLE FULL | X$KTADM | 1 | 64 | 0 (0)| 00:00:01 |
-
|* 12 | FIXED TABLE FULL | X$KTATRFIL | 1 | 64 | 0 (0)| 00:00:01 |
-
|* 13 | FIXED TABLE FULL | X$KTATRFSL | 1 | 64 | 0 (0)| 00:00:01 |
-
|* 14 | FIXED TABLE FULL | X$KTATL | 1 | 64 | 0 (0)| 00:00:01 |
-
|* 15 | FIXED TABLE FULL | X$KTSTUSC | 1 | 64 | 0 (0)| 00:00:01 |
-
|* 16 | FIXED TABLE FULL | X$KTSTUSS | 1 | 64 | 0 (0)| 00:00:01 |
-
|* 17 | FIXED TABLE FULL | X$KTSTUSG | 1 | 64 | 0 (0)| 00:00:01 |
-
|* 18 | FIXED TABLE FULL | X$KTCXB | 1 | 64 | 0 (0)| 00:00:01 |
-
|* 19 | FIXED TABLE FULL | X$KSUSE | 1 | 19 | 0 (0)| 00:00:01 |
-
|* 20 | FIXED TABLE FULL | X$KSQRS | 1 | 22 | 0 (0)| 00:00:01 |
-
---------------------------------------------------------------------------------------
-
-
Predicate Information (identified by operation id):
-
---------------------------------------------------
-
-
2 - access(TO_CHAR(USERENV('INSTANCE'))||RAWTOHEX("RADDR")=TO_CHAR("R"."INST
-
_ID")||RAWTOHEX("R"."ADDR"))
-
3 - access("SADDR"="S"."ADDR")
-
6 - filter(USERENV('INSTANCE') IS NOT NULL)
-
9 - filter("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0)
-
10 - filter("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0)
-
11 - filter("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0)
-
12 - filter("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0)
-
13 - filter("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0)
-
14 - filter("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0)
-
15 - filter("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0)
-
16 - filter("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0)
-
17 - filter("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSOBFLG",1)<>0)
-
18 - filter("KSQLKREQ"=6 AND ("KSQLKMOD"<>0 OR "KSQLKREQ"<>0) AND
-
"INST_ID"=USERENV('INSTANCE') AND BITAND("KSSPAFLG",1)<>0)
-
19 - filter("S"."INST_ID"=USERENV('INSTANCE'))
-
20 - filter("R"."KSQRSIDT"='TX')
-
-
-
Statistics
-
----------------------------------------------------------
-
1 recursive calls
-
1 db block gets
-
0 consistent gets
-
0 physical reads
-
0 redo size
-
596 bytes sent via SQL*Net to client
-
520 bytes received via SQL*Net from client
-
2 SQL*Net roundtrips to/from client
-
0 sorts (memory)
-
0 sorts (disk)
-
1 rows processed
从300多秒降低到 0.1秒
但是监控系统是
“成熟”商业软件,不能改写语句,怎么办呢?
设置触发器?还是设置某个神奇的隐含参数?
以下方法有的情况下有效:
-
begin
-
dbms_stats.gather_table_stats('SYS','x$ksuse',method_opt=>'for all columns size 1');
-
dbms_stats.gather_table_stats('SYS','x$ksqrs',method_opt=>'for all columns size 1');
-
end;
-
/
对于视图内的合并连接卡迪森,之前的方法
alter session set "_optimizer_mjc_enabled"=flase;不起作用
阅读(1516) | 评论(0) | 转发(0) |