Stored Outline存储提纲介绍
第一篇:outline是什么? outline设计来提供稳定的执行计划,以消除执行环境或对象统计信息的改变造成的影响。这个特性叫做计划稳定性。其实outline就是一堆hint的集合。 查询优化器接收到sql后,在选择是否使用OUTLINE时的逻辑。 a.对SQL语句进行标准化去除
第一篇:outline是什么? outline设计来提供稳定的执行计划,以消除执行环境或对象统计信息的改变造成的影响。这个特性叫做计划稳定性。其实outline就是一堆hint的集合。 查询优化器接收到sql后,在选择是否使用OUTLINE时的逻辑。 a.对SQL语句进行标准化去除空白大小写差异 b.计算签名 c.对比数据字典,看是否已存在一样的签名 d.如果是,再进一步比较sql语句是否相同(避免hash冲突) e.如果SQL一样,就可以将这个outline的相关hint收入郎中,以影响执行计划的生成了。9i开始就可以用outline,但10g开始才可以从共享池的一个游标来手动创建outline。 要使用use_stored_outlines,必须开启use_stored_outlines参数 alter system set use_stored_outlines = test; 当一条SQL语句有sql profile又有outline时,查询优化器会有限选择outline。 何时使用: 每当调优一条特殊的SQL并且无法在应用程序里修改它时(比如,不能使用hint),就可以使用这项技术。但如果加了hint也不走一些执行计划,那用outline也木有用。 比如id列是varchar2(1)并且有索引,而sql用where to_number(id)=1,此时加了/*+index(t ind)*/也不走索引,用outline也无补于事。
第二篇:创建outline
1.自创创建outline ALTER [SESSION | SYSTEM] SET create_stored_outlines=TRUE|类别名; 例子:alter session set create_stored_outlines=fwy; --true模式的category是default 这个参数无法在参数文件指定,只能起库后再人工或触发器指定。
2.手动创建outline 2.1 基于文本 create or replace outline out_1 --for category test on select 3+8 from dual;
2.2.基于hash_value begin dbms_outln.create_outline( hash_value=>'1812086974', child_number =>0 -- category => 'test' ); end; /
第三篇:查询outline select * from dba_outlines where timestamp>sysdate-1/24;--过去一小时刚建的outline select * from dba_outlines where timestamp>sysdate-5/(24*60); --过去5分钟建的outline select hint from dba_outline_hints where name='OUTLINE_FROM_TEXT';--查询某个outline的hint集合
查看outline是否有被使用 1. 10gR2起,dbms_xplan函数看执行计划,会看到是否有使用Outline 2. 所有版本通行: execute dbms_outln.clear_used(name=> 'OUT_1'); --重置outline使用标记 select used from dba_outlines where name='OUT_1';--显示UNUSED 然后执行SQL select used from dba_outlines where name='OUT_1';--此时如果显示为used,则上述SQL有用到该OUTLINE了。
第四篇:更改OUTLINE --Rename outline alter outline SYS_OUTLINE_13090110433120101 rename to out2;
--更改单个outline的类别 alter outline out2 change category to default;
--更改多个outline类别,属于类别TEST的整体替换为类别default execute dbms_outln.update_by_cat(oldcat=>'TEST',newcat=>'DEFAULT');
--重建存储提纲 当你希望query optimizer根据新环境产生一个新的hint集合,可以使用它。比如改变了outline相关对象的访问结构时。 alter outline out_1 rebuild;
--query optimizer只考虑激活的outline,outline有两个条件符合才可以被激活 --第一,要处于enable状态。 创建时默认就是。如果不是可以通过以下语句做状态变换。 alter outline out_1 enable; alter outline out_1 disable; --第二,初始化参数use_stored_outlines在session级别或system级别激活。 true就是用default类别,false就是不用outline,或者某个类别名。 alter session set use_stored_outlines=true; alter system set use_stored_outlines=true; --这个参数一次只能激活一个类别,也就是跟sql profile一样,一个会话一次只能用一个类别。 十分奇怪的是,这个参数无法在pfile或者spfile中设置,只能实例系统后再设置。也可以借助触发器完成。
第五篇:移动outline --------------------------------------- vi exp.par userid="/ as sysdba" file=exp01.dmp log=exp_outline.log tables=(outln.ol$,outln.ol$hints,outln.ol$nodes) query="where ol_name ='FWY_3'" ---------------------------------------------------- exp parfile=exp.par ------------------------------vi imp.par userid="/ as sysdba" file=exp01.dmp log=imp_outline.log full=y ignore=y -----------------------------imp parfile=imp.par
--移动单个outline或者单个类别,在上述基础上加上以下语句 query="where ol_name ='OUT_1'" query="where category='TEST'" 比如,如果一个给定的 SQL语句的执行计划使用了一个你本想避免的索引扫描,那么你可以在测试系统中删除索引,在那里生成一个Outline,然后再将其转移到生产环境。
第六篇:编辑outline 想要编辑outline里面的hint,对数据字典中的公有outline用一些普通的SQL进行update是不行的,而对私有outline进行编辑是可行的。私有outline是存储在工作表中的,经过创建、编辑、测试后,我们可以将私有outline发布成公有outline。
1创建的两种方法 1.1. create or replace private outline out_3 on select * from dual; 1.2 create private outline p_out_1 from public out_1;
--10g后,默认工作表就是在system用户下的ol$,ol$hints,ol$nodes,还有默认的三个公共同义词指向它们。对于这三个表,在outln中也是有的,这才是作为公有的outline而存在的表。 如果用9i,就要手动创建工作表与公共同义词。 sqlplus '/as sysdba' alter session set current_schema=system; execute dbms_outln_edit.create_edit_tables;
create or replace public synonym ol$ for system.ol$;
create or replace public synonym ol$hints for system.ol$hints; create or replace public synonym ol$nodes for system. ol$nodes ;
grant select,insert,update,delete on system.ol$ to public; grant select,insert,update,delete on system.ol$hints to public; grant select,insert,update,delete on system.ol$nodes to public;
一旦私有outline创建完毕,就可以列出私有outline相关的Hint select hint#,hint_text from system.ol$hints where ol_name='OUT_4';
--然后用普通的sql语句可以更新它的hint --本来HINT#的1的hint_text是 INDEX(@"SEL$1" "T"@"SEL$1" ("T"."N")) --现在要变成走全表扫描 update ol$hints set hint_text='FULL(@SEL$1 T)' where hint#=1 and ol_name='P_OUTLINE_EDITING'; --为了确保这个outline在内存中的副本也同步进行了更改,执行如下 execute dbms_outln_edit.refresh_private_outline('OUT_1') --接着,激活并测试这个private outline. alter session set use_private_outlines =true; explain plan for select * from t where n=1970; select * from table(dbms_xplan.display(null,null,'basic +note)')); --如果对private outline满意,就可以使用下面这个sql将它发布成public outline. create public outline out_1 from private p_out_1;
第七篇 删除存储提纲 删除单个 drop outline out_1; 删除整类别 dbms_outln.drop_by_cat(cat=>'TEST'); 删除私有提纲 drop private outline out_1;
第八篇:OUTLINE互换 --将BEFORE与AFTER两个outline互换 UPDATE OUTLN.OL$HINTS SET OL_NAME=DECODE(OL_NAME,'AFTER','BEFORE','BEFORE','AFTER') WHERE OL_NAME IN ('AFTER','BEFORE');
exec dbms_outln.update_signatures; --更新签名
drop outline after;--更换完后,可以将不用的outline删除
第九篇:其他事项 在10gr1之前,outline是不能覆盖初始化参数,为了成功用outline,这几个初始化参数要与执行化境设置保持一致才可以噢。 optimizer_features_enable query_rewrite_enabled star_transformation_enabled
A用户创建的outline,B用户也可以用,不用授权。 OUTLINE在RAC环境下,每个实例都需要开启使用参数,才能用OUTLINE。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Users may have seen the term wapi when using the Internet, but for some people they definitely don’t know what wapi is. The following is a detailed introduction to help those who don’t know to understand. What is wapi: Answer: wapi is the infrastructure for wireless LAN authentication and confidentiality. This is like functions such as infrared and Bluetooth, which are generally covered near places such as office buildings. Basically they are owned by a small department, so the scope of this function is only a few kilometers. Related introduction to wapi: 1. Wapi is a transmission protocol in wireless LAN. 2. This technology can avoid the problems of narrow-band communication and enable better communication. 3. Only one code is needed to transmit the signal

Pubg, also known as PlayerUnknown's Battlegrounds, is a very classic shooting battle royale game that has attracted a lot of players since its popularity in 2016. After the recent launch of win11 system, many players want to play it on win11. Let's follow the editor to see if win11 can play pubg. Can win11 play pubg? Answer: Win11 can play pubg. 1. At the beginning of win11, because win11 needed to enable tpm, many players were banned from pubg. 2. However, based on player feedback, Blue Hole has solved this problem, and now you can play pubg normally in win11. 3. If you meet a pub

This website reported on March 7 that Dr. Zhou Yuefeng, President of Huawei's Data Storage Product Line, recently attended the MWC2024 conference and specifically demonstrated the new generation OceanStorArctic magnetoelectric storage solution designed for warm data (WarmData) and cold data (ColdData). Zhou Yuefeng, President of Huawei's data storage product line, released a series of innovative solutions. Image source: Huawei's official press release attached to this site is as follows: The cost of this solution is 20% lower than that of magnetic tape, and its power consumption is 90% lower than that of hard disks. According to foreign technology media blocksandfiles, a Huawei spokesperson also revealed information about the magnetoelectric storage solution: Huawei's magnetoelectronic disk (MED) is a major innovation in magnetic storage media. First generation ME

Introduction to Python functions: Introduction and examples of exec function Introduction: In Python, exec is a built-in function that is used to execute Python code stored in a string or file. The exec function provides a way to dynamically execute code, allowing the program to generate, modify, and execute code as needed during runtime. This article will introduce how to use the exec function and give some practical code examples. How to use the exec function: The basic syntax of the exec function is as follows: exec

SPDIFOUT connection line sequence on the motherboard. Recently, I encountered a problem regarding the wiring sequence of the wires. I checked online. Some information says that 1, 2, and 4 correspond to out, +5V, and ground; while other information says that 1, 2, and 4 correspond to out, ground, and +5V. The best way is to check your motherboard manual. If you can't find the manual, you can use a multimeter to measure it. Find the ground first, then you can determine the order of the rest of the wiring. How to connect motherboard VDG wiring When connecting the VDG wiring of the motherboard, you need to plug one end of the VGA cable into the VGA interface of the monitor and the other end into the VGA interface of the computer's graphics card. Please be careful not to plug it into the motherboard's VGA port. Once connected, you can

i5 is a series of processors owned by Intel. It has various versions of the 11th generation i5, and each generation has different performance. Therefore, whether the i5 processor can install win11 depends on which generation of the processor it is. Let’s follow the editor to learn about it separately. Can i5 processor be installed with win11: Answer: i5 processor can be installed with win11. 1. The eighth-generation and subsequent i51, eighth-generation and subsequent i5 processors can meet Microsoft’s minimum configuration requirements. 2. Therefore, we only need to enter the Microsoft website and download a "Win11 Installation Assistant" 3. After the download is completed, run the installation assistant and follow the prompts to install Win11. 2. i51 before the eighth generation and after the eighth generation

After updating to the latest win11, many users find that the sound of their system has changed slightly, but they don’t know how to adjust it. So today, this site brings you an introduction to the latest win11 sound adjustment method for your computer. It is not difficult to operate. And the choices are diverse, come and download and try them out. How to adjust the sound of the latest computer system Windows 11 1. First, right-click the sound icon in the lower right corner of the desktop and select "Playback Settings". 2. Then enter settings and click "Speaker" in the playback bar. 3. Then click "Properties" on the lower right. 4. Click the "Enhance" option bar in the properties. 5. At this time, if the √ in front of "Disable all sound effects" is checked, cancel it. 6. After that, you can select the sound effects below to set and click

Git is a fast, reliable, and adaptable distributed version control system. It is designed to support distributed, non-linear workflows, making it ideal for software development teams of all sizes. Each Git working directory is an independent repository with a complete history of all changes and the ability to track versions even without network access or a central server. GitHub is a Git repository hosted on the cloud that provides all the features of distributed revision control. GitHub is a Git repository hosted on the cloud. Unlike Git which is a CLI tool, GitHub has a web-based graphical user interface. It is used for version control, which involves collaborating with other developers and tracking changes to scripts and
