RE: Optimizing a Simple 'select count(*)'

From: Tefft, Michael J <>
Date: Fri, 7 Mar 2014 19:23:25 +0000
Message-ID: <>

It is not necessary for completion_time to be NOT NULL for a index on that column to be suitable for this query.

Suppose you have rows that have completion_time as null? So what? That predicate will exclude them anyway - and the optimizer knows this, and it will gladly use an index on completion_time if it exists (and if it makes sense). The biggest question is: Does an index actually exist, with that column?

I don't think that has not been explicitly stated, and I have had (a few) occasions when I struggled for hours with the question 'why won't it use the index on that column' because I assumed it had to exist, but never verified it was really there.


Received on Fri Mar 07 2014 - 20:23:25 CET

Original text of this message