Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to improve this query?
Tom Miskiewicz wrote:
> Hi!
>
> Thanks for your reply.
>
>
>>If all you want to test for is not null and your column is indexed then
>>should use >>select count(*) >>from table >>where col is not null;
correct.
Just be aware that
select count(myfield) from mytable;
will solve your initial question and count all records where myfield is not null. It will do a full table scan even if the column is indexed so you should do what Cris wrote.
Janne! Received on Mon Nov 24 2003 - 12:49:56 CST
![]() |
![]() |