当前位置: 移动技术网 > IT编程>数据库>Oracle > oracle表准备、索引测试、查询SQL执行次数、创建表空间方法详解

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

2018年12月09日  | 移动技术网IT编程  | 我要评论

学习人力资源,漆亚灵个人资料,武穴楼盘

先放张体系图,

这里写图片描述

表准备

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

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网