Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Count(*) Vs Count(1)
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C066E4.C5CBFA70
Content-Type: text/plain;
charset="iso-8859-1"
I think we should send this whole sordid affair up to the Supreme Count.
HAHAHAHAHAHAHAHAHAHAHA!!!!! Man, I crack myself up.
Time to start the weekend, boys and girls...
--Walt Weaver
Bozeman, Montana, USA
-----Original Message-----
From: Richard Ji [mailto:richard_at_letsplay.com]
Sent: Friday, December 15, 2000 2:53 PM
To: Multiple recipients of list ORACLE-L
Subject: RE: Count(*) Vs Count(1)
Oracle has optimized the count(*) for performance.
Richard Ji
-----Original Message-----
From: root_at_fatcity.com [mailto:root_at_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_001_01C066E4.C5CBFA70
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.00.2920.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=674362722-15122000>I
think we should send this whole sordid affair up to the Supreme
Count.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=674362722-15122000></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=674362722-15122000>HAHAHAHAHAHAHAHAHAHAHA!!!!!</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=674362722-15122000></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=674362722-15122000>Man, I
crack myself up.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=674362722-15122000></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=674362722-15122000>Time
to start the weekend, boys and girls...</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=674362722-15122000></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=674362722-15122000>--Walt
Weaver</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=674362722-15122000>
Bozeman, Montana, USA</SPAN></FONT></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV align=left class=OutlookMessageHeader dir=ltr><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Richard Ji
[mailto:richard_at_letsplay.com]<BR><B>Sent:</B> Friday, December 15, 2000 2:53
PM<BR><B>To:</B> Multiple recipients of list ORACLE-L<BR><B>Subject:</B> RE:
Count(*) Vs Count(1)<BR><BR></DIV></FONT>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=984000222-15122000>Oracle has optimized the count(*) for
performance.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=984000222-15122000></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=984000222-15122000>Richard Ji</SPAN></FONT></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV align=left class=OutlookMessageHeader dir=ltr><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> root_at_fatcity.com
[mailto:root_at_fatcity.com]<B>On Behalf Of </B>Sanjay Kumar<BR><B>Sent:</B>
Friday, December 15, 2000 2:51 PM<BR><B>To:</B> Multiple recipients of list
ORACLE-L<BR><B>Subject:</B> Count(*) Vs Count(1)<BR><BR></DIV></FONT>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I issed the following two statements andgenerated a plan using Explain Plan. The table on which I tried this query was v$cache.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Select Count(*) from v$cache</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Select Count(1) from v$cache</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I found that the explain plan generated thesame plan for both the statements. Does that mean that both the statements
are equally efficient.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>In my opinion, I feel that Count(1) is betterthan Count(*).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Kindly explain.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>Thanks</FONT></DIV> <DIV><FONT face=Arial size=2>Rgds</FONT></DIV> <DIV><FONT face=ArialReceived on Fri Dec 15 2000 - 16:17:12 CST
![]() |
![]() |