Re: Finding overlapping intervals efficiently

2002-02-25 Thread Colin Dewey
I did some playing around with various indices on the tables and found that the fastest configuration was without any indices! With two tables (t1 and t2) with fields "start" and "end", using an index (start, end) or indices on the on the two fields separately, the speed of joining the two tab

Finding overlapping intervals efficiently

2002-02-21 Thread Colin Dewey
Given two tables (t1 and t2) with fields "start" and "end", what is the most efficient method of finding the all the intervals in the first table that overlap any interval in the second table? Right now, I use a query like: SELECT t1.name, t2.name FROM t1, t2 WHERE t1.start <= t2.end AND t1.en