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: SQL Code

Re: SQL Code

From: <sfaroult_at_oriole.com>
Date: Fri, 12 Jan 2001 09:50:01
Message-Id: <10739.126470@fatcity.com>


Kevin,

    Partition your table, otherwise it will be the query of death. Short of that, the only thing which might be helpful is a function-based index on the suitably truncated (down to the hour) timestamp, it would help the 'GROUP BY' a lot.

HTH Stephane Faroult
Oriole Corporation

>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
><HTML>
><HEAD>
><META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Diso-885>9-1">

><META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version 5.5.2652.3>5">

><TITLE>SQL Code</TITLE>
></HEAD>
><BODY>
>
><P><FONT SIZE=3D2>Hi All,</FONT>
></P>
>
><P><FONT SIZE=3D2>I have an interesting problem, lets say I have a table
>with 2 fields, one with a code, and the other with a full datestamp,
-+ 8> million records.</FONT></P>
>
><P><FONT SIZE=3D2>What will the SQL code be to query this table, to
show >the result - the count of all codes that occur between every hour for the> day, ie</FONT></P>
>
><P><FONT SIZE=3D2>5 counts of code type a, 6 of type b etc, between
01h00> and 02h00</FONT>
><BR><FONT SIZE=3D2>7 counts of type a, 8 of b etc, between 02h00 and
03h0>0 etc etc etc</FONT>
></P>
>
><P><FONT SIZE=3D2>Any ideas anybody ?</FONT>
><BR><FONT SIZE=3D2>Thanx</FONT>
><BR><FONT SIZE=3D2>Kevin N</FONT>
></P>
>
>
><DIV>
><DIR><FONT color=3D#0000ff size=3D1>
><P>______________________________________________</FONT><FONT face=3DAria>l
size=3D1><B><FONT face=3DArial
>size=3D2></FONT></B></FONT></P>
><P><FONT face=3DArial size=3D1><B><FONT face=3DArial size=3D2>Disclaimer >and

>confidentiality note</B></FONT></FONT></P>
><P><FONT face=3DArial size=3D1><FONT face=3DArial size=3D2>Everything in >this
e-mail and
>any attachments relating to the official business of Standard Bank
Invest>ment
>Corporation</FONT><FONT color=3D#0000ff face=3DArial size=3D2> </FONT><FO>NT
face=3DArial
>size=3D2>(Stanbic) is proprietary to the company. It is confidential,
leg>ally
>privileged and protected by law. Stanbic</FONT><FONT color=3D#0000ff
face>=3DArial
>size=3D2> </FONT><FONT face=3DArial size=3D2>does not own and endorse any>
other
>content. Views and opinions are those of the sender unless clearly
stated> as
>being that of Stanbic. </FONT></FONT></P>
><P><FONT face=3DArial size=3D1><FONT face=3DArial size=3D2>The person add>ressed
in the
>e-mail is the sole authorised recipient. Please notify the sender
immedia>tely if
>it has unintentionally reached you and do not read, disclose or use
the c>ontent
>in any way.</P>
><P align=3Djustify></P>
><P>Stanbic can not assure that the integrity of this communication
has be>en
>maintained nor that it is free of errors, virus, interception or

>interference.</P></FONT></FONT><FONT color=3D#0000ff></DIR>
><P><FONT
>size=3D1>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0&nbs>p;=A0=A0_______________________________________________</FONT></P><>/FONT></DIV>

></BODY>
></HTML>>
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>--
>Author: Naik, Kevin K
> INET: KNaik_at_mail.sbic.co.za
>
>Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051

>San Diego, California -- Public Internet access / Mailing Lists

>--------------------------------------------------------------------

>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 Jan 12 2001 - 09:50:01 CST

Original text of this message

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