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(*)

RE: count(*)

From: Jamadagni, Rajendra <Rajendra.Jamadagni_at_espn.com>
Date: Fri, 20 Sep 2002 11:29:47 -0800
Message-ID: <F001.004D570C.20020920112947@fatcity.com>


Content-Type: multipart/alternative;
 boundary="----_=_NextPart_001_01C260D3.45550180" ------_=_NextPart_001_01C260D3.45550180
Content-Type: text/plain;
 charset="iso-8859-1"

Hmmm ... everyone is throwing their ideas around ... so here is mine ...

Hopefully on this large table you have a PK.

  1. First time when you do the count(*) (I hope it will be > 10 minutes), do it as follows ...

select count(*), max(pk_column)
from my ludicrously_large_table
/

Somehow, remember the max(pk_column) value.

Next time onwards do ...
select count(*), max(pk_column)
from my ludicrously_large_table
where pk_column > previously_saved_max_pk_column_value /

Then add this count(*) plus last count(*) to get the total number.

How is that ??

Raj



Rajendra Jamadagni MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.

QOTD: Any clod can have facts, but having an opinion is an art!

------_=_NextPart_001_01C260D3.45550180
Content-Type: text/html;
 charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.19">
<TITLE>RE: count(*)</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Hmmm ... everyone is throwing their ideas around ... so here is mine ...</FONT>
</P>

<P><FONT SIZE=2>Hopefully on this large table you have a PK.</FONT>
</P>

<P><FONT SIZE=2>1. First time when you do the count(*) (I hope it will be &gt; 10 minutes), do it as follows ...</FONT>
</P>

<P><FONT SIZE=2>select count(*), max(pk_column)</FONT>
<BR><FONT SIZE=2>from my ludicrously_large_table</FONT>
<BR><FONT SIZE=2>/</FONT>
</P>

<P><FONT SIZE=2>Somehow, remember the max(pk_column) value.</FONT>
</P>

<P><FONT SIZE=2>Next time onwards do ...</FONT>
<BR><FONT SIZE=2>select count(*), max(pk_column)</FONT>
<BR><FONT SIZE=2>from my ludicrously_large_table</FONT>
<BR><FONT SIZE=2>where pk_column &gt; previously_saved_max_pk_column_value</FONT>
<BR><FONT SIZE=2>/</FONT>
</P>

<P><FONT SIZE=2>Then add this count(*) plus last count(*) to get the total number.</FONT>
</P>

<P><FONT SIZE=2>How is that ??</FONT>
</P>

<P><FONT SIZE=2>Raj</FONT>
<BR><FONT SIZE=2>______________________________________________________</FONT>
<BR><FONT SIZE=2>Rajendra Jamadagni&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MIS, ESPN Inc.</FONT>
<BR><FONT SIZE=2>Rajendra dot Jamadagni at ESPN dot com</FONT>
<BR><FONT SIZE=2>Any opinion expressed here is personal and doesn't reflect that of ESPN Inc. </FONT>
<BR><FONT SIZE=2>QOTD: Any clod can have facts, but having an opinion is an art!</FONT>
</P>

</BODY>
</HTML>

------_=_NextPart_001_01C260D3.45550180--

------=_NextPartTM-000-2fb63b37-564d-4e8c-90f0-c24fcab18810 Content-Type: text/plain;
 name="ESPN_Disclaimer.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="ESPN_Disclaimer.txt"

*********************************************************************This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you.*********************************************************************1

------=_NextPartTM-000-2fb63b37-564d-4e8c-90f0-c24fcab18810--

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jamadagni, Rajendra
  INET: Rajendra.Jamadagni_at_espn.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri Sep 20 2002 - 14:29:47 CDT

Original text of this message

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