mysql执行计划固定_固定执行计划-SQL PROFILE手工绑定

固定(稳定)执行计划

你的应用的功能时快时慢,变化比较大,功能的性能能够保持一种稳定的状态,ORACLE 固定执行计划,采用以下这几种方式

oracle 9i使用 Outline

oracle 10g采用 sql profile

oracle 11g增加了sql plan manage

oracle 10g采用 sql profile :两种模式

从SQL语句历史的执行计划,找到一个合理的,进行绑定

还有一种无法从历史的执行计划找到合理的,只能手工构造进行绑定

提供脚本

create_sql_profile

提供绑定shared pool中已有的执行计划中,找一个绑定或自己构造一个绑定

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

----------------------------------------------------------------------------------------

--

-- File name: create_sql_profile.sql

--

-- Purpose: Create SQL Profile based on Outline hints in V$SQL.OTHER_XML.

--

-- Author: Kerry Osborne

--

-- Usage: This scripts prompts for four values.

--

-- sql_id: the sql_id of the statement to attach the profile to (must be in the shared pool),if sql_id is not shared pool,must be bulid sql plan

--

-- child_no: the child_no of the statement from v$sql

--

-- new_sql_id:需要绑定的SQL语句

--

-- profile_name: the name of the profile to be generated

--

-- category: the name of the category for the profile

--

-- force_macthing: a toggle to turn on or off the force_matching feature

--

-- Description:

--

-- Based on a script by Randolf Giest.

--

-- Mods: This is the 2nd version of this script which removes dependency on rg_sqlprof1.sql.

--

-- See kerryosborne.oracle-guy.com for additional information.

---------------------------------------------------------------------------------------

--

-- @rg_sqlprof1 '&&sql_id' &&child_no '&&new_sql_id' '&&category' '&force_matching'

set feedback off

set sqlblanklines on

accept sql_id -

prompt 'Enter value for sql_id: ' -

default 'X0X0X0X0'

accept child_no -

prompt 'Enter value for child_no (0): ' -

default '0'

accept new_sql_id -

prompt 'Enter value for new_sql_id: ' -

default '0'

accept profile_name -

prompt 'Enter value for profile_name (PROF_sqlid_planhash): ' -

default 'X0X0X0X0'

accept category -

prompt 'Enter value for category (DEFAULT): ' -

default 'DEFAULT'

accept force_matching -

<
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值