ORACLE 查询不走索引的原因以及强制索引
索引失效的原因分析:
解决方法: 分析方法有一下几种: analyze table t2 compute statistics for allcolumns;?--针对表字段收集信息 analyze table t3 compute statistics for all indexescolumns;?--收集索引字段信息 analyze table t4 computestatistics;???????--收集表,表字段,索引信息 analyze table t5 compute statistics for allindexes;?????????--收集索引信息 analyze table t6 compute statistics for table for all indexesfor allcolumns;???-- --收集表,索引,表字段信息
解决办法: 在这种条件下 oracle会认为索引更占资源,就默认不走索引了。这种情况如果觉得索引快的 不妨试试强制索引? ? select ??/*+INDEX(t IDEX_HZYB_JSJL_BDJSRQ)*/? ?from hzyb_jsjl t
in null时 ? 必须要和建立索引第一列一起使用,当建立索引第一位置条件是is null 时,其他建立索引的列可以是is null(但必须在所有列都满足is null的时候),或者=一个值; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |