【ubuntu】Ubuntu 18.04中重启php7
517 2023-04-03 02:06:01
索引失效的原因分析:
分析方法有一下几种:
analyze table t1 compute statistics fortable; --针对表收集信息
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
where BDJSRQ >TO_DATE(‘‘,‘‘);
其中T是 表名 IDEX_HZYB_JSJL_BDJSRQ 是表的索引
in null时 必须要和建立索引第一列一起使用,当建立索引第一位置条件是is null 时,其他建立索引的列可以是is null(但必须在所有列都满足is null的时候),或者=一个值;
当建立索引的第一位置是=一个值时,其他索引列可以是任何情况(包括is null =一个值),以上两种情况索引都会走。其他情况不会走。