GilaMonster (8/28/2015)
Kristen-173977 (8/27/2015)
Is this a scenario that could, however rarely, occur?(the dup/missing rows can happen only on scans)
I need to look into this further, but its a very helpful piece of info (which I didn't realise), many thanks.
The code isn't as simple as the example I have posted, and instead of the NOT EXISTS I have shown there is quite a lot of
DOC.SomeAttribute IN
(
SELECT SomeID
FROM SomeTable
WERE SomeUserCredential = 'X'
...
and generally "= 'X' " also includes an OR with a further nested sub-select, often several levels deep, so, sadly, I think there is a racing-chance that the Optimiser decides on a SCAN somewhere along the way 🙁
I will keep that in mind from now on when I'm pouring over the Query Plans 🙂