先放张体系图,
表准备
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