1、
select ×
from tab
where substring(id,1,4)= ‘1234’
如何优化? 2、
select ×
from tab
where kinnum/100 < 1000
如何优化? 3、说说oracle有哪些优化方案。 以上三道题请各位指教。谢谢!!
select ×
from tab
where substring(id,1,4)= ‘1234’
如何优化? 2、
select ×
from tab
where kinnum/100 < 1000
如何优化? 3、说说oracle有哪些优化方案。 以上三道题请各位指教。谢谢!!
解决方案 »
- 关于表中相同字段相加的问题
- oracle,win2003,vmware7.1.4做rac的步骤?
- Oracle监听是否可以通过SQL来查询
- select * from A group by ____ 填什么和select * from A 查出的结果 一样
- 一个sql求和问题
- ORA-24333: zero iteration count
- 动态sql语句关于select的
- 函数问题
- 小弟对数据库不是很懂,请教各位大侠两条sql有什么不同?谢谢!
- 帮我看看这是什么错误
- 两个oracle数据库,如何实现表的同步?~~~~~~~~~~~~~~~~~~~~~~~~~谢谢各位
- ORACLE 9I数据库字符集是BIG5,保存简体字出现乱码
没经过测试
1、在substring上建立函数索引
2、方法同一
3、google
select ×
from tab
where kinnum < 100000
怎么建立在〔substring〕上建立函数索引啊!
1、
select ×
from tab
where substring(id,1,4)= ‘1234’
如何优化?
改成:
select x from tab where id like '1234%';
id字段上当然得有索引2、
select ×
from tab
where kinnum/100 < 1000
如何优化?
改:
select x from tab where kinum < 100000
CREATE TABLE TEST
(
COL1 VARCHAR2(10),
COL2 VARCHAR2(10)
);CREATE INDEX IDX_TEST
ON TEST(SUBSTR(COL1,1,4))第二个类似的建立索引
1、
select ×
from tab
where substring(id,1,4)= ‘1234’
如何优化?
改成:
select x from tab where id like '1234%';
id字段上当然得有索引 2、
select ×
from tab
where kinnum/100 < 1000
如何优化?
改:
select x from tab where kinum < 100000
严重同意
from tab
where id like 1234'||'%'
2、
select ×
from tab
where kinnum < 100000
3、说说oracle有哪些优化方案。这个关系理论太多了
同意4楼的答案,最后一个问题,仅提供一些参考:
sql优化方案
1 使用where 条件减少检索结果的数量
2 使用表之间的连接而不使用多个查询
3 执行连接的时候、使用完全限定的列的引用
4 使用case表达式、而不使用多个查询
5 添加表的索引
6 使用where而不是 having
7 使用union all 而不是 union
8 使用exist而不是in
9 使用exist而不是distinct
旧的索引对字段进行函数运算是不起效果的,要建函数索引,如果楼主要使用自己写的SQL就要建函数索引;想用回旧的索引就要SQL改为4楼的写法
sql的书写,尽量共享
sql每个表的连接方式如果可以显式指定,则可以减少解析时间
……