table1(id,type,info) id字段:是guid 字符串 type字段:字符串类型 如 '010000' info字段: varchar2(2000)aaaaq 010000 阿萨德212饿阿萨德asd。。bbbas 030000 阿斯发达省份adf23。table2(id,name)id字段:是guid 字符串 name字段:varchar2(100)aaaaq 阿斯达岁的bbbas 阿萨德
每个表的数据在400万以上问题 1
select * from table1 where type='010000' and info like '%阿斯%' 这个查询执行很慢我找资料说用全文索引 然后
select * from table1 where contains(info, '阿斯')>0 很快 但加上 and type='010000' 速度又慢了我给 type加个索引 还是很慢 请问怎么办??问题2
select t.type,d.name FROM table1 t,table2 d where t.id=d.id and contains(t.info ,'人民')>0
这样连接查询超级慢怎么办?求助。求大家给点解决办法 小弟在此谢过了。
每个表的数据在400万以上问题 1
select * from table1 where type='010000' and info like '%阿斯%' 这个查询执行很慢我找资料说用全文索引 然后
select * from table1 where contains(info, '阿斯')>0 很快 但加上 and type='010000' 速度又慢了我给 type加个索引 还是很慢 请问怎么办??问题2
select t.type,d.name FROM table1 t,table2 d where t.id=d.id and contains(t.info ,'人民')>0
这样连接查询超级慢怎么办?求助。求大家给点解决办法 小弟在此谢过了。
如果你的 type 字段中重复记录很多的话,建立一个 bit map 索引,可以提高查询速度。问题2
T2表的ID字段上建立一个索引。
2、info字段建立索引。
select * from table1 where type='010000' and info like '%阿斯%' 这个查询执行很慢我找资料说用全文索引 然后
select * from table1 where contains(info, '阿斯')>0 很快 但加上 and type='010000' 速度又慢了我给 type加个索引 还是很慢 请问怎么办??问题2
select t.type,d.name FROM table1 t,table2 d where t.id=d.id and contains(t.info ,'人民')>0
这样连接查询超级慢第一个,你的写法是'%=阿斯%' ,你这样写就算有索引oracle也不会给你走索引的,如果用like模糊查询oracle只对like '阿斯%'这样的语句才会进行索引检索数据。
问题2你如果在id上加了索引还没效果那就还真得好好看看了。
速度还是会和以前的速度是一样的。。
不会有减少
你建索引要根据你的Where后面的条件来确定的。
like '%啊啊%'这样的where条件 我能怎么办? 前提是改成这样都不行 like '啊啊%'
如果数据量大的话那查询就会特别的慢。