Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: is it possible in pl/sql?

Re: is it possible in pl/sql?

From: david wendelken <davewendelken_at_earthlink.net>
Date: Thu, 10 Feb 2005 09:05:26 -0500 (GMT-05:00)
Message-ID: <26519803.1108044326647.JavaMail.root@huey.psp.pas.earthlink.net>

It's always good to have folks challenge your beliefs - helps one to grow!

It would never have occurred to me to count the number of reads - because the same number of rows would have to be read either way.

Where I believed the efficiency to come in was in the internals of the processing of the count function.

In other contexts, * means "all the columns returned by the query". A reasonable extrapolation in this case would mean "the values of all the columns returned by the query".

Since count does not increment it's internal counter when the value passed to it is null, it made sense to believe that the count function had to check the values returned to verify whether a non-null value had been passed to it.

Therefore, it made sense to expect it to have to parse (via if-statement logic) thru the values to determine whether the aggregate value was null. I/O wouldn't be longer but more cpu time would be required.

This morning, I tested count(*) against a table that had a row comprised solely of null values and that row was counted. (Never tested that before as I've never thought of a reason to have a table like that!)

Checked the manual, and it is treating the * as a special character, not as I believed.

So, you guys are right on that point! Thanks.

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Feb 10 2005 - 09:08:19 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US