Message-Id: <10711.124757@fatcity.com> From: "Richard Ji" Date: Fri, 15 Dec 2000 16:49:23 -0500 Subject: RE: Count(*) Vs Count(1) This is a multi-part message in MIME format. ------=_NextPart_000_0020_01C066B8.D40DBE60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Oracle has optimized the count(*) for performance. Richard Ji -----Original Message----- From: root@fatcity.com [mailto:root@fatcity.com]On Behalf Of Sanjay Kumar Sent: Friday, December 15, 2000 2:51 PM To: Multiple recipients of list ORACLE-L Subject: Count(*) Vs Count(1) Hi, I issed the following two statements and generated a plan using Explain Plan. The table on which I tried this query was v$cache. Select Count(*) from v$cache Select Count(1) from v$cache I found that the explain plan generated the same plan for both the statements. Does that mean that both the statements are equally efficient. In my opinion, I feel that Count(1) is better than Count(*). Kindly explain. Thanks Rgds Sanjay ------=_NextPart_000_0020_01C066B8.D40DBE60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Oracle=20 has optimized the count(*) for performance.
 
Richard Ji
-----Original Message-----
From: root@fatcity.com=20 [mailto:root@fatcity.com]On Behalf Of Sanjay = Kumar
Sent:=20 Friday, December 15, 2000 2:51 PM
To: Multiple recipients of = list=20 ORACLE-L
Subject: Count(*) Vs Count(1)

Hi,
 
I issed the following two statements = and=20 generated a plan using Explain Plan. The table on which I tried this = query was=20 v$cache.
 
Select Count(*) from = v$cache
 
Select Count(1) from = v$cache
 
I found that the explain plan = generated the same=20 plan for both the statements. Does that mean that both the statements = are=20 equally efficient.
 
In my opinion, I feel that Count(1) = is better=20 than Count(*).
 
Kindly explain.
 
Thanks
Rgds
Sanjay