Ora 9.2 SQL: What's the fastest way to do this set operation...



Imagine I have a database of 10,000 trains and their ordered list of
(around 2 million) scheduled locations, keyed on those trains and an
order number. I want to go from A to B and there are no direct trains.
I need to find all the pairs of trains, one going through A and the
other through B, that share AT LEAST ONE OTHER location in common, call
it C.

The only way I can think of doing it is to find the set of trains T_A
that go through A, and the set of trains T_B that go through B, and see
if there is any intersection in their route locations.

As far as I can tell, doing the INTERSECT means actually calculating
the entire intersection, even though I only need to know that at least
one location is common to both trains.

Is there a fast function in oracle (9.2) that will do something like
this - something along the lines of OVERLAPS.

If I do the join on LOCATION, or a count of locations in T_A that are
in T_B, I get the correct answer but it is taking 10 seconds+, and I'd
like to reduce that.

Thanks for any help.

Dean

.



Relevant Pages

  • Re: Scientology Sponsors Bluebell Railway Extension
    ... We are here because of our common interest in the railways of the ... One can respect the faith of certain posters, ... Right, trains. ... I went on the Cumbrian coast line at the ...
    (uk.railway)
  • Re: Worcester
    ... I have a photo of a 31 on this circular service taken, I think, in ... BUT I remember Worcester trains were Cl 47 by 1968 already. ... I suppose I may have seen them in Paddington in 75 and not realised ... This was in the late 70s 31s were quite common just after the Westerns ...
    (uk.railway)
  • Re: Virgin tones
    ... Sometimes they're in quick succession, and sometimes they're very slow - but always the same three notes. ... I've never seen a full explanation, but the chances are it's indicating some fault or other. ... The same tones used to be very common when MML introduced Meridians, but are much less common now. ...
    (uk.railway)
  • Re: air conditioning may be making us fat
    ... *much* more common in winter, ... in winter and summer, in offices, shops and trains. ... Mike Reid. ...
    (rec.travel.europe)
  • Re: Ora 9.2 SQL: Whats the fastest way to do this set operation...
    ... I want to go from A to B and there are no direct trains. ... directed network capability and the routing engine. ...
    (comp.databases.oracle.misc)