Oracle:On ROWNUM and Limiting Results
转载记录一篇关于ROWNUM伪列的文章来自Tom Kyte大师 https://blogs.oracle.com/oraclemagazine/on-rownum-and-limiting-results This issue’s Ask Tom column is a little different from the typical column. I receive many quest
非分区键的GLOBAL分区索引键值更新会造成麻烦吗?
ROWID BMB
一条SQL语句查询块分解及查询转换
原始语句如下:select BIZ_NO, OUT_BIZ_NO, ORDER_NO, USER_ID, user_name, CARD_NO, ACCOUNT_NO, ACCOUNT_BIZ_NO,&n...
VLDB and Partitioning Guide 读书摘要
1、If a global index partition contains data, dropping the partition causes the next highest partition to be marked unusable. You cannot drop the highest partition in a global index. p2-142、The highest partition of a global index must have a partition bound, all of whose val...
关于直方图中关于字符类型的ENDPOINT_VALUE字段的转换
今天看书(基于ORACLE的SQL优化)看到关于直方图dba_histograms ENDPOINT_VALUE字段的计算问题所以记录如下:1、数字类型的ENDPOINT_VALUE没有什么悬念就是其本生的值2、字符类型的ENDPOINT_VALUE计算相对复杂,是取字符的头15的字节经过16进制DUMP后在转换为十进制进行的测试如下:SQL> select count(*),...
About Oracle WITH clause
About Oracle WITH clauseStarting in Oracle9i release 2 we see an incorporation of the SQL-99 “WITH clause”, a tool for materializing subqueries to save Oracle from having to re-compute them multiple times.The SQL “WITH clause” is very similar to the use of Global temporary tables (GTT), a tec...
使用SPM和STA进行固定执行计划
在实际的工作中可能遇到SQL执行计性能划退化的可能性,除了研究退化原因以外,我们可能需要固定其执行计划 一、如下列子展示如果在多个执行计划中使用SPM选择正确的执行计划,SPM默认是不会自动建立BASELINE的。但是可以修改参数开启自动建立(optimizer_capture_sql_plan_baselines)但是建议不要开启,如果开启自...
关于UPDATE中关联查询的执行时间考虑
update testj3 set object_id = (select USER_ID from testj2 where testj3.owner = testj2.username)考虑如上的语句,如何估算其时间...
HASH分区表的好处和注意点
一、好处 1、对于分区本生不需要定期的进行分区加入(范围分区和LIST分区需要定期的对新加入的值新建分区) 2、可以消除访问热点块及索引热点块,由于索引是排序后的结构,对于一列自增的列加入范围分区,可能对索引的高位块进行频繁的数据插入,导致频繁的写入和分裂 对于这样的索引如...
ORACLE 半连接与反连接
概念:所谓半连接,就是在进行连接查询的时候,内层如果有相应的记录及返回一个TRUE,而不需要访问余下的行,如果内层表特别巨大的时候将会大大节省时间。列子: select /* using in */ department_name from hr.departments dept where department_id in (select depart...
AVG_LEAF_BLOCKS_PER_key 和 AVG_DATA_BLOCKS_PER_KEY 说明
按照官方文档的说明AVG_LEAF_BLOCKS_PER_KEY:Average number of leaf blocks in which each distinct value in the index appears, rounded to the nearest integer. For indexes that enforce UNIQUEand PRIMARY KEYconstraints, this value is always 1每一个不同的键值平均页块的数量,如果是唯一和...
latch: row cache objects 和cursor: pin S wait on X共同出现
Snap Id Snap Time Sessions Cursors/SessionBegin Snap: 5980 11-Nov-13 16:00:37 1403 39.6End Snap: 5981 11-Nov-13 16:31:29 1422 42.8Elapsed: 30.86 (mins) DB Time: 3,660.60 (mins) ...
等待模拟-read by other session
表TEST是一个130M的表。create or replace procedure test_buffer_readis begin for x in (select * from test) loop null; end loop;end;var job_no number;begin ...
等待模拟-cache buffer chain
出现CACHE BUFFER CHAIN 后首先查看V$SESSION_WAIT 找到P1raw的值,此P1对应了v$latch_children addr和 x$bh 的HLADDR然后查看v$latch_children 找到GET最高的LATCH ADDR select * from v$latch_children where ...
等待模拟-library cache shared pool 硬解析
drop table test1;create table test1(it int);insert into test1values(10);create table test2asselect * from test1;create table test3asselect * from test1;create table test4asselect * from test1;create t...
等待模拟-library cache 软解析
create table test(it int);insert into testvalues(10);commit;create or replace procedure do_soft_parse(p_idx in number) is v_value number; v_cursor sys_refcursor;&n...
等待模拟-BUFFER BUSY WAIT
create table test_buf(id number,name char(1000))tablespace test;begin for idx in 1..100 loop insert into test_buf values(idx,'aa'); end loop;end;select dbms_rowid.rowid_relative_f...
log buffer 分配需要的 latch
1、数据的修改是在PGA上以CHANGE VECTOR存储,其包含3部分撤销头修改内容,撤销块修改内容,数据库修改内容,把CHANGE VECTOR复制到log BUFFER,需要获得REDO COPY锁存器,整个过程都需要,如果发生争用出现REDO COP...
BUFFER CACHE寻找流程
1、获得保护hash bucket的CACHE BUFFERS CHAINS锁存器,读取需要SHARED模式,如果是修改则需要EXCLUSIVE模式,如果发生争用等待latch:cache buffers chains2、查看BUFFER HEADER,块是否已经在BUFFER里面,如果...
CACHE BUFFER CHAINS
出现CACHE BUFFER CHAIN 后首先查看V$SESSION_WAIT 找到P1raw的值,此P1对应了v$latch_children addr和 x$bh 的HLADDR然后查看v$latch_children 找到GET最高的LATCH ADDR select * from v$latch_children where ...