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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL: Working with huge tables of chronological data

Re: SQL: Working with huge tables of chronological data

From: EdStevens <quetico_man_at_yahoo.com>
Date: 6 Apr 2007 13:31:56 -0700
Message-ID: <1175891515.948587.226400@n59g2000hsh.googlegroups.com>


On Apr 6, 9:49 am, "Ana C. Dent" <anaced..._at_hotmail.com> wrote:
> "EdStevens" <quetico_..._at_yahoo.com> wrote innews:1175870668.939557.173360_at_y66g2000hsf.googlegroups.com:
>
>
>
> > On Apr 5, 10:03 pm, "Ana C. Dent" <anaced..._at_hotmail.com> wrote:
> >> "John" <acide.ascorbi..._at_gmail.com> wrote in
> >> news:1175802637.291526.37550 @p77g2000hsh.googlegroups.com:
>
> >> >> Is this the real problem or a simplification?
> >> > It's a simplification but not that much. The real problem involves
> >> > user_ids but this part can be skipped here.
>
> >> >> Is this something that will be run once or repeatedly?
> >> > Only once.
>
> >> >> Is it possible for the same time to be in A and B?
> >> > No, A and B are completely different data.
>
> >> >> Is it possible to have a B before an A beginning the sequence?
> >> >> Is it possible for there to be multiple Bs between As?
> >> > Yes everything is possible, A events and B events happen
> >> > independently.
>
> >> > Thanks for being interested in my problem!
>
> >> > John
>
> >> I would NOT use SQL to solve this problem.
> >> I'd use Perl or PL/SQL.
> >> Treat Table_A & Table_B as ordered lists (based upon field of choice;
> >> timestamp, ID , whatever).
> >> You only needs to pass thru each list a single time.
> >> Open two read loops; one on A & one on B.
> >> Read 1 record from each list.
> >> 1) If A < B, then read record from A.
> >> 2) If A < B, then you found 1st hit & read record from A
> >> 3) If B < A, then read record from B
> >> 4) If B < A, the you have a hit & read record from B
> >> etc. loop until no more records
>
> > Classic sort/merge logic. Something every cobol programmer learned
> > the first week on the job. Something we often forget with all of our
> > point/click/object programming. Sometimes the old, simple solutions
> > are still the best.
>
> I did not claim it to be original, just effective.
> Yes, I did learn this techique when doing Cobol programming.

Didn't mean to sound sarcastic (if that's what you were thinking -- the shortcomings of written communications, both ways). Just taking a mild dig at everyone else (myself included) for losing sight of the simple but un-sexy solution.

As an unrepentant old cobol programmer myself, I miss the old days. Received on Fri Apr 06 2007 - 15:31:56 CDT

Original text of this message

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