Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL: Working with huge tables of chronological data
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.
Ah, the limitations of the written word. It sounds to me as if you thought I was being sarcastic. Maybe I'm misunderstanding you now, or maybe you misunderstood me ... I was not meaning to be sarcastic toward your post. If anything, I was giving a bit of a dig to everyone else (including myself) for missing the obvious.
As an old, unrepentant cobol programmer myself, please accept my apology. Received on Fri Apr 06 2007 - 14:07:24 CDT
![]() |
![]() |