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: Count(*) Vs Count(1)

RE: Count(*) Vs Count(1)

From: Weaver, Walt <wweaver_at_rightnow.com>
Date: Fri, 15 Dec 2000 15:17:12 -0700
Message-Id: <10711.124759@fatcity.com>


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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;
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>&nbsp;</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>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>I issed the following two statements and 
    generated 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>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Select Count(*) from v$cache</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Select Count(1) from v$cache</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>I found that the explain plan generated the 
    same plan for both the statements. Does that mean that both the statements
    are equally efficient.</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>In my opinion, I feel that Count(1) is better 
    than Count(*).</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Kindly explain.</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Thanks</FONT></DIV>
    <DIV><FONT face=Arial size=2>Rgds</FONT></DIV>
    <DIV><FONT face=Arial 
Received on Fri Dec 15 2000 - 16:17:12 CST

Original text of this message

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