Originally posted by jdorlon
I just wanted to make sure to point out that if you add the hint
you can really speed things up, since everybody is looking
for the fastest ways to count records but nobody mentioned
it. You'd think the optimizer would be smart enough to
figure out to use the index without a hint, but it (at least
in my experience) isn't.
Agreed. It is always worth looking at the plan, even on something as simple as SELECT COUNT. I've definitely noticed that the optimizer makes some interesting choices when dealing with COUNT(). I haven't been able to put my finger on the discriminating factor(s) yet. Sometimes it makes perfect choices and sometimes it misses the obvious index. Ah well...

- Chris