Re: inner join on range criteria: unable to use index?
Posted by:
Rick James
Date: September 26, 2008 11:38PM
Didn't you want an OR somewhere in this?
select * from s inner join r on r.tstart >= s.chrstart and and r.tstart <= s.chrstop and r.tend <= s.chrstop and r.tend >== s.chrstart and r.tname=s.chr and r.strand=s.chrstrand;
Anyway -- Inequalities tend to stop further use of indexes. Do start with = situations (as pointed out by others).
Another solution (though it may not be practical here) is to bucketize the start/end thingies. That is, change the data (and api) to turn the range into... Well, let me give an example: Suppose the ranges are times. The buckets could be hours. Now instead of > and <, say WHERE time_bucket = hr . Further, if it extends beyond one hour, use UNION, not OR. And if that is not precise enough, it still might be good for reducing the number of rows it has to look at. [Sorry if this is not clear enough.]
Subject
Views
Written By
Posted
10323
August 11, 2008 04:34PM
3668
August 11, 2008 05:56PM
3730
August 11, 2008 06:04PM
3547
August 12, 2008 01:38AM
3219
August 12, 2008 09:30AM
3161
August 12, 2008 07:11PM
3693
August 12, 2008 12:52PM
Re: inner join on range criteria: unable to use index?
3036
September 26, 2008 11:38PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.