select /*+ full(t1) */ * from t1;--全表扫描
select /*+ index(t1 idx_name) */ * from t1 where object_id>2;使用指定索引
select /*+ no_index(t1 idx_name) */ * from t1 where object_id>2; --不使用指定索引
select /*+ index_desc(t1 idx_name) */ * from t1 where object_id=2; --按索引降序顺序访问数据
select /*+ index_combine(t1 idx_name) */ * from t1;--选择位图索引
select /*+ index_ffs(t1 idx_name) */ from t1 where object_id <100; --索引快速全表扫描(把索引当作一个表看待)
select /*+ index_join(t1 idx_name1 idx_name2) */ * from t1 where object_id=5 and status='VALID'; --同时使用条件列上的相关索引
select /*+ index_ss(t1 index_name) */ * from t1 where object_id=99; --跳跃式扫描
select /*+ leading(t1,t) */ t.* from t,t1 where t1.object_id=t.object_id; --指定t1为驱动作,优化器先访问此表
select /*+ ordered */ t.* from t,t1 where t1.id=t.id; --指定按from 后面表的顺序选择驱表,t作为驱动表
select /*+ use_nl(t1,t) */ t.* from t1,t where t1.object_id=t.object_id;--使用NEST LOOP表连接,适合含有小表数据关联,如一大一小(有别名,必须用别名)
select /*+ use_hash(t1,t) */ t.* from t1,t where t1.object_id=t.object_id;--使用HASH表连接,适合两个大表关联
select /*+ use_merge(t1,t) */t.* from t1,t where t1.object_id=t.object_id;--使用合并排序表连接
select /*+ no_use_nl(t1,t) */ t.* from t1,t where t1.object_id=t.object_id; --不使用NEST LOOP表连接
select /*+ no_use_hash(t1,t) */ t.* from t1,t where t1.object_id=t.object_id;--不使用HASH表连接
select /*+ no_use_merge(t1,t) */t.* from t1,t where t1.object_id=t.object_id; --不使用合并排序表连接
/*+OPTIMIZER_FEATURES_ENABLE('10.2.0.4')*/
SELECT /*+ PUSH_PRED (v1) */ t1.c1,v1.c1
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




