Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

problem with index

$
0
0

this is on a sql2016 server, and only happens in our unit test server, the other 2 are fine.

this is the query:

select c.PATH, v.Version
from [ZCOMP] c, [ZVER] v
where c.DNUM = 711 and c.VID = v.VID 
and v.V = (select max( V) from [ZVER] v1 where c.DNUM = 711);
we have index on DNUM AND VID, and with just those index, the query runs great. 
but, if we add index to V, it runs very slow, looking at the live stat, it doing a index scan of V and the percentage is not 100%, but in the millions, like 66090404%
again, the issue only happens in 1 environment, the other 2 environment is fine.
** forgot to mention, we need the additional index for other queries.

Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>