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

Home -> Community -> Mailing Lists -> Oracle-L -> Count(*) Vs Count(1)

Count(*) Vs Count(1)

From: Sanjay Kumar <ora_user_at_hotmail.com>
Date: Fri, 15 Dec 2000 11:54:35 -0800
Message-Id: <10711.124745@fatcity.com>


This is a multi-part message in MIME format.

------=_NextPart_000_0019_01C0668D.CB51C710 Content-Type: text/plain;

        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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_0019_01C0668D.CB51C710 Content-Type: text/html;

        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I issed the following two statements =
and generated=20
a plan using Explain Plan. The table on which I tried this query was=20 v$cache.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Select Count(*) from =
v$cache</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Select Count(1) from =
v$cache</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>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.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>In my opinion, I feel that Count(1) is =
better than=20
Count(*).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Kindly explain.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Rgds</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Sanjay</FONT></DIV></BODY></HTML>
Received on Fri Dec 15 2000 - 13:54:35 CST

Original text of this message

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