欢迎投稿

今日深度:

oracle表准备、索引测试、查询SQL执行次数、创建

oracle表准备、索引测试、查询SQL执行次数、创建表空间方法详解,oraclesql


先放张体系图,

这里写图片描述

表准备

create table t as select * from all_objects;

索引测试

    create index idx_object_id on t(object_id);

查询

select * from t where object_id = 29

执行计划查看:cost 2

第二次查询,查询这条指令的hash值会存在共享区,数据会被缓存在sga的数据缓冲区。

添加HINT ,强制走全表扫描

select /*+full(t)*/ * from t where object_id = 29;

执行计划查看:cost 287

查询SQL执行次数

SELECT t.sql_text,t.sql_id,t.parse_calls,t.executions
from v$sql t
where sql_text like '%insert into T values%' ORDER BY t.executions desc

创建表空间

create tablespace TBS_LJB_A
datafile 'F:\oracle_data\TBS_LJB_A_01.DBF' size 1M
autoextend ON
uniform size 64K

在指定表空间创建表

create table t_a(id int) tablespace TBS_LJB_A

插入测试数据

insert into t_a select rownum from dual connect by level<=10000000

www.htsjk.Com true http://www.htsjk.com/oracle/24072.html NewsArticle oracle表准备、索引测试、查询SQL执行次数、创建表空间方法详解,oraclesql 先放张体系图, 表准备 create table t as select * from all_objects; 索引测试 create index idx_object_id on t(object_id); 查询 se...
评论暂时关闭