Oracle之索引和插入的优化案例
来源:互联网 发布:数据分析师招聘要求 编辑:程序博客网 时间:2024/06/05 10:13
drop table t purge;
create table t as select * from dba_objects;
insert into t select * from t;
insert into t select * from t;
commit;
--请从这里开始注意累加的时间(从建索引到插入记录完毕)
set timing on
create index idx_t_owner on t(owner);
create index idx_t_obj_name on t(object_name);
create index idx_t_data_obj_id on t(data_object_id);
create index idx_t_created on t(created);
create index idx_t_last_ddl on t(last_ddl_time);
--语句1(t表有6个索引)
insert into t select * from t;
commit;
--以下进行试验2
drop table t purge;
create table t as select * from dba_objects;
insert into t select * from t;
insert into t select * from t;
commit;
---也从这里开始这里开始注意累加的时间(从插入记录完毕到建索引完毕)
set timing on
--语句1(t表有6个索引,此时先不建)
insert into t select * from t;
create index idx_t_owner on t(owner);
create index idx_t_obj_name on t(object_name);
create index idx_t_data_obj_id on t(data_object_id);
create index idx_t_created on t(created);
create table t as select * from dba_objects;
insert into t select * from t;
insert into t select * from t;
commit;
--请从这里开始注意累加的时间(从建索引到插入记录完毕)
set timing on
create index idx_t_owner on t(owner);
create index idx_t_obj_name on t(object_name);
create index idx_t_data_obj_id on t(data_object_id);
create index idx_t_created on t(created);
create index idx_t_last_ddl on t(last_ddl_time);
--语句1(t表有6个索引)
insert into t select * from t;
commit;
--以下进行试验2
drop table t purge;
create table t as select * from dba_objects;
insert into t select * from t;
insert into t select * from t;
commit;
---也从这里开始这里开始注意累加的时间(从插入记录完毕到建索引完毕)
set timing on
--语句1(t表有6个索引,此时先不建)
insert into t select * from t;
create index idx_t_owner on t(owner);
create index idx_t_obj_name on t(object_name);
create index idx_t_data_obj_id on t(data_object_id);
create index idx_t_created on t(created);
create index idx_t_last_ddl on t(last_ddl_time);
解析:一个表在建立多个索引情况下,插入数据统计时间。
一个表先插入数据,后建立索引。
前者时间远大于后者,因为索引是有顺序的,当插入数据时候也需要维护顺序,当大量插入数据时候就会产生偏移,插入一个会维护一次,所以速度慢。
解决:做多个数据库,生产数据库和查询数据库,生产数据库不建索引,所有的查询动作都在查询数据库实现。
阅读全文
0 0
- Oracle之索引和插入的优化案例
- oracle性能优化之索引
- Oracle之分区表和索引优化,分区表字段回表
- 通过案例学调优之--Oracle 全文索引
- oracle索引和sql优化
- Oracle之SQL优化-索引的基本原理(一)
- Oracle之SQL优化-索引的基本原理(二)
- oracle sql优化案例1(使用组合索引)
- oracle优化关于索引的
- Oracle数据库的优化--索引
- ArcSDE/Oracle的简单优化(图层和索引分开)
- 《Oracle SQL优化基础》之索引
- Mysql性能优化案例研究 - 覆盖索引和SQL_NO_CACHE
- Oracle优化器和索引原理
- Lucene入门之索引的建立和优化
- 3、学习lucene之索引的更新和优化
- 排序算法之选择和插入排序的简单优化
- oracle :性能优化的一个案例
- git的基本命令
- Spring Bean的生命周期
- c语言 有关数组的入门简单题
- OpenCV里面Mat方法中的Scalar详解
- 最短路(Dijkstra)Kuangbin大神的模板
- Oracle之索引和插入的优化案例
- 【UVa1153】Keep the Customer Satisfied 顾客是上帝(贪心)
- HDU 5195 DZY Loves Topological Sorting
- C++中引用的用法
- ajax调用webservice注意事项
- Codevs 2833 奇怪的梦境
- JavaScript观察者模式
- 多机调度问题 贪心策略
- 黑客原则:不能仇视社会,不能给别人制造麻烦,不能给别人带来损失