I wrote a statement that takes almost an hour to run so I am asking help so I can get to do this faster. So here we go:
I am making an inner join of two tables :
<
The first thing I do is have your database tool generate an execution plan that you can view (this is "Control-L" in MSSQL, but I'm not sure how to do it in Oracle) - that will try to point out the slow parts and, depending on your Server/Editor, it may even recommend some basic indexes. Once you have an execution plan, you can look for any table scans of inner loop joins, both of which are really slow - indexes can help with table scans, and you can add additional join predicates to help alleviate loop joins.
My guess would be the MEASURES needs an index on the TIME column, and you can include the MEASURE column as well to speed lookups. Try this:
CREATE INDEX idxMeasures_Time ON Measures ([Time]) INCLUDES (Measure)
Also, though this won't change your execution plan or speed up your query, it may make your join clause a bit easier read:
ON measures.time BETWEEN intervals.entry_time AND intervals.exit_time
This just combines your two <= and >= into a single statement.