关键字: oracle 优化
象like '%abc%'之类的查询对于大表来说是个致命的性能瓶颈。下面说说如何优化.
该文的内容来自www.oracle.com.cn
.原文是英文的。
1.如何优化 like '%abc'.
这种优化建立反序索引就可以了。
2.如何优化 like 'abc%'
这种比较好办,直接建立索引就可以了
3.如何优化 like '%abc%'
比如:
a.建立测试表mytable
create table mytable as select a.*,rpad('0',400,'0') dummy from all_objects a;
b.然后建立
起索引作用的表mytable_myind
create table mytable_myind as select a.rowid rid,a.object_name from mytable a
c.把起索引作用的表mytable_myind钉到内存里面
alter table mytable_myind storage (buffer_pool keep);
alter table mytable_myind cache;
d.执行如下的sql语句:如果对于数据量大的表,那么速度有很大的提高。
select /*+rule*/ owner from mytable where rowid in
( select rid from mytable_myind
where object_name like '%DUAL%'
);
当然,可以使用触发器来更新表mytable_myind
分享到:
相关推荐
外研版(一起)英语二年级上册 Module1 I like the ABC song._(课件).ppt
外研版(一起)英语二年级上册 Module1 Unit 1 I like the ABC song.(课件).ppt
本课件是一个优秀的英语ppt课件,课件中的相关知识点,帮助老师更好的完成本科的教学,是很好的教学工具。...该文档为I like the ABC song PPT课件4,是一份很不错的参考资料,具有较高参考价值,感兴趣的可以下载看看
如果查询中的比较要返回包含\\\"abc \\\"(abc后有一个空格)的所有行,则将不会返回包含\\\"abc\\\"(abc后没有空格)的列所在行。但是可以忽略模式所要匹配的表达式中的尾随空格。如果查询中的比较要返回包含\\\...
java source code is enable here. Like to learn java.
三、实验结果和代码 use abc go create view abc as select CPM,JG,SCCJ from CPB where SCCJ like '@北京@' and JG<(select AVG(JG) from CPB where SCCJ like '@北京@' ); create procedure proc_abc @zgh_yh ...
thid is wonderful to again see a program like thid jaijsksds asdfg vbnm lkio puy trvted
代码如下:String myname = “abc”;String sql = “select * from mytable where name like ‘?%'”;Cursor cursor = db.rawQuery(sql, new String[]{myname};运行提示如下错误: 代码如下:java.lang....
数学建模-2007年美赛题(ABC).zip
数学建模-2006年美赛题(ABC).zip
写java程序时用来拼装sql...from abc where a like('3') 转换为: sql.append("select "); sql.append(" a, "); sql.append(" b, "); sql.append(" c "); sql.append("from abc "); sql.append("where a like('3') ");
如sql查询条件的like查询, AND c.name like concat(#{param.name},’%’) 将Int 转为varchar经常用 concat函数,比如concat(8,’0′) 得到字符串 ’80’ 2、Cast函数;CONVERT函数。 用法:CAST(expr AS type), ...
写java程序时用来拼装sql...from abc where a like('3') 转换为: sql.append("select "); sql.append(" a, "); sql.append(" b, "); sql.append(" c "); sql.append("from abc "); sql.append("where a like('3') ");
例如,“[abc]”匹配“a”、“b”或“c”。为了命名字符的一个范围,使用一个“-”。“[a-z]”匹配任何小写字母,而“[0-9]”匹配任何数字。 “ * ”匹配零个或多个在它前面的东西。例如,“x*”匹配任何数量的“x”...
索引与约束 索引 1、如何建立索引 create index 索引名 on ...explain plan for select ename,job,sal from empcon where ename like ‘PRE%’; Select id,operation,options,object_name,position from plan_table;
在刚装完mysql,就建立了数据库abc,然后新建一个abc表,插入英文没有问题,但是插入中文就有问题,会报错: ERROR 1366 (HY000): Incorrect string value: ‘\xE4\xBD\x99\xE9\x93\xB6…’ 应该是数据库编码问题,...
原始单元格: 871-30233中文-KE1-01-01&A字符FDDF显示吧+ABC 按以下要求提取字符 提取中文字 :中文字符显示吧 提取英文字 :KEAFDDFABC 提取数字 :8713023310101 提取特殊字 :----&+ 提取非中文字:871-30233...
bol = Asc(tempchar) < 0 Or tempchar Like "[a-z,A-Z]" Or tempchar Like "#" If bol = False Then tempname = tempname & tempchar End If Next i If tempname = 0 Then tempname = "N/A" SpecialChar = tempname ...
预览双语评论Laravel配套(用Laravel Blade(bootstrap)和VUE JS制成) 免费... ' to COMMENTER model like ' User 'use Ashkan \C omment \T raits \H asComments ;class User extends Authenticatable{ use HasFacto
11-15 BBABC 选择 1-5 AABCA 6-10 DDCAB 11-15 BBBDD 完型 1-5 CBAAC 6-10 DACAB 阅读 1-5 CADCD 6-7 DA 8-10 ADD 单词 1 cultural 2 controlled 3 polluting 4 businesses 5 proud 6 risen 7 ache 8 agreement 9 ...