但是,还有个问题,为什么表上会很错误的用上索引了???
比如a表的custid上有索引,那么select custid form a group by custid应该不会用上索引的,为什么会用上索引?甚至这样,select custid+0 form a group by custid+0 也会用上custid的索引,为什么?
(我是在执行计划里看到它确实用了索引的)请各位遇到过这种类似问题的朋友指教!!
但在这个问题之上,我发现的这个奇怪问题,不知是什么原因呢???
简单一点来说:
cust表的custid上建有索引,为什么我执行下面的语句时,用执行计划看仍然要用到索引呢??
1.select custid from cust;
2.select custid from cust group by custid;
3.select custid+0 from cust group by custid+0;
这三条语句,都用到了相同的索引,即custid上建的索引!!
大家帮忙看看,到底什么原因使得着个表有如此问题呢?????
但在这个问题之上,我发现的这个奇怪问题,不知是什么原因呢???
简单一点来说:
cust表的custid上建有索引,为什么我执行下面的语句时,用执行计划看仍然要用到索引呢??
1.select custid from cust;
2.select custid from cust group by custid;
3.select custid+0 from cust group by custid+0;
这三条语句,都用到了相同的索引,即custid上建的索引!!
大家帮忙看看,到底什么原因使得着个表有如此问题呢????? [/B]