当前位置:网站首页>An example of SPM manual binding execution plan
An example of SPM manual binding execution plan
2022-06-24 03:11:00 【laosu】
background
oracle 11.2.0.4
primary sql A Don't walk index , select /*+ no_index(t1 idx_01)*/ from t1 where object_id=5;
Manually generate indexed SQL B Implementation plan of ,select /*+ index(t1 idx_01)*/ from t1 where object_id=5;
take B The execution plan of is bound to A, send SQL A Go to the index .
The detailed steps
see sql A Of SQL_ID and PLAN_HASH_VALUE
-- from v$sql View query select sql_id,plan_hash_value,sql_text,parse_calls,executions from v$sql where sql_text like 'select /*+ no_index(t1 idx_01)*%'; -- or sqlplus in , After execution sql After execution select * from table(dbms_xplan.display_cursor(null,null,'advanced'));
establish sql A Of baseline, Generate sql_handle
declare tmp number; begin tmp := DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE(sql_id => 'g3auf3vcmtr6z',plan_hash_value => 3910739905,enabled => 'NO'); end; /
see baseline,A Of sql_handle
select sql_handle,plan_name,origin,enabled,accepted,sql_text from dba_sql_plan_baselines where sql_text like 'select /*+ no_index(t1 idx_01)*/%';
Generate what you need sql B Implementation plan of
Execute multiple times as follows SQL select /*+ index(t1 idx_01)*/ from t1 where object_id=5; obtain SQL B Of sql id and plan_hash value, The above two methods are acceptable select * from table(dbms_xplan.display_cursor(null,null,'advanced')); select sql_id,plan_hash_value,sql_text,parse_calls,executions from v$sql where sql_text like 'select /*+ index(t1 idx_01)*%';
take sql A Of sql_handle And B Associated with the execution plan
declare tmp number; begin tmp := DBMS_SPM.load_plans_from_cursor_cache(sql_id => 'fsfyjhcrv6kwb', -- new sql_id ,sql B plan_hash_value => 34099177, --new plan_hash_value, sql B sql_handle => 'SQL_4fd8b0b98686fd73' -- primary sql Of sql_handle, sql A ); end; / or : exec :tmp :=dbms_spm.load_plans_from_cursor_cache(sql_id=>'fsfyjhcrv6kwb',plan_hash_value=>34099177,sql_handle=>'SQL_4fd8b0b98686fd73');
see sql_handle, And delete the original execution plan
-- Check out the original SQL handle Implementation plan of select sql_handle,plan_name,origin,enabled,accepted,sql_text from dba_sql_plan_baselines where sql_handle='SQL_4fd8b0b98686fd73'; -- see baseline sql_handle Execution plan content select * from table(dbms_xplan.display_sql_plan_baseline(sql_handle=>'SQL_4fd8b0b98686fd73',plan_name=>'SQL_PLAN_4zq5hr638dzbmd147f332')); -- Delete exec :tmp := dbms_spm.drop_sql_plan_baseline(sql_handle=>'SQL_4fd8b0b98686fd73',plan_name=>'SQL_PLAN_82y5y7jctbuxrb2fbea4c');
complete .
边栏推荐
- 2022-2028 global genome editing mutation detection kit industry survey and trend analysis report
- Principle of efficient animation Implementation-A preliminary exploration of jetpack compose
- Shopee Clickhouse cold and hot data separation storage architecture and Practice
- 2022-2028 global third-party data platform industry research and trend analysis report
- Sinclair radio stopped broadcasting many TV stations, suspected of being attacked by blackmail software
- Disaster recovery series (V) -- database disaster recovery construction
- 2022-2028 global tungsten copper alloy industry research and trend analysis report
- Dry goods how to build a data visualization project from scratch?
- Why can't cloud games connect to the server? What if the cloud game fails to connect to the server?
- Cp/rm/mv parameters
猜你喜欢

2022-2028 global high tibial osteotomy plate industry research and trend analysis report

2022-2028 global pilot night vision goggle industry research and trend analysis report
![[51nod] 2106 an odd number times](/img/af/59b441420aa4f12fd50f5062a83fae.jpg)
[51nod] 2106 an odd number times

2022-2028 global aircraft wireless intercom system industry research and trend analysis report

2022-2028 global medical coating materials industry research and trend analysis report

The cost of on-site development of software talent outsourcing is higher than that of software project outsourcing. Why
![[51nod] 3047 displacement operation](/img/cb/9380337adbc09c54a5b984cab7d3b8.jpg)
[51nod] 3047 displacement operation
![[summary of interview questions] zj5](/img/d8/ece82f8b2479adb948ba706f6f5039.jpg)
[summary of interview questions] zj5

2022-2028 Global Industry Survey and trend analysis report on portable pressure monitors for wards

2022-2028 global aircraft audio control panel system industry research and trend analysis report
随机推荐
JMeter uses JDBC to perform database pressure test
2022-2028 global portable two-way radio equipment industry research and trend analysis report
How to install the cloud desktop security server certificate? What can cloud desktops do?
Three Scheduling Strategies in yarn
Easycvr cannot be played when cascaded to the superior platform. Troubleshooting
2022-2028 global third-party data platform industry research and trend analysis report
How do I check the trademark registration number? Where do I need to check?
Grpc: based on cloud native environment, distinguish configuration files
Tencent cloud CIF engineering effectiveness summit was successfully opened, and coding released a series of new products
What is cloud desktop and how to connect to the server? What does the mainstream architecture of cloud desktop include?
[51nod] 3216 Awards
System design: File Hosting Service
Applicationclientprotocol of yarn source code
MySQL case deep excavation information_ Root causes of slow schema view query (Part 2)
2022-2028 Global Industry Survey and trend analysis report on portable pressure monitors for wards
Cloud call: one line of code is directly connected to wechat open interface capability
Introduce the comparison of various distributed configuration centers? Which distributed configuration center is better?
What are the responsibilities of cloud desktop administrators? How to use cloud desktop?
Grpc: how to reasonably manage log configuration?
Tencent cloud launched its new 100g+ cloud server product!! Expect more than 400g+ in the future!