倒吊宰杀女尸图片,吾家有个冰山大恶魔,浩劫与重播
准则:当任何单个查询要检索的行少于或等于整个表行数的10%时,就应当创建索引。
b-树索引:索引的候选列应该是用来存储很大范围的值的列
位图索引:包含小范围值的列
注意:由于性能原因,应该将索引与表存储到不同的表空间中。
假设test表包含很多行
select id,type from test where type='01';
create index i_test_type on test(type);
唯一索引
create unique index i_test_id on test(id);
复合索引
create index i_test_id_type on test(id, type);
select id,type from test where type=upper('sfz');
create index i_func_test_type on test(upper(type));
注意:使用基于函数的索引,必须要将初始化参数query_rewrite_enabled设置为true。
select index_name, table_name, uniqueness, status from user_indexes where table_name='test';
select index_name, table_name, column_name from user_ind_columns where table_name='test';
alter index i_test_id_type rename to i_test_id_and_type;
drop index i_test_id_and_type;
create bitmap index i_order on order(status);
注意:视图并不存储行,他们始终存储在表中。视图返回存储在表中的行
connect system/systemgrant create view to zoey; connect zoey/zoey create view test_view asselect * from test where type='02';
使用视图
select id from test_view;
注意:简单视图支持dml操作,复杂视图不支持dml操作。
create view test_view2 asselect * from test where type='02' with check option constraint test_view2;
create view test_view3 asselect * from test where type='02' with read only constraint test_view2;
describe test_view3;
select constraint_name, constraint_type, status , deferrable, deferred from user_constraintswhere table_name='test';
create or replace view test_view3 asselect * from test where type in ('02', '01');
drop view test_view3;
create flashback archive test_archivetablespace example --归档在example创建 quota 1 m --限额是1m retention 1 day;--保留期限是1天
停止归档
alter zoey.test no flashback archive;
清除归档中的所有数据
alter flashback archive test_archive purge all;
删除闪回归档
drop flashback archive test_archive;
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Oracle字符串函数length、upper、lower、initcap、 concat、instr、replace
网友评论