Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Speeding up query that contains BETWEEN

Speeding up query that contains BETWEEN

From: David Saracini <dsaracini_at_yahoo.com>
Date: 9 May 2002 07:37:10 -0700
Message-ID: <45c4f95.0205090637.e85b997@posting.google.com>


Hello All,

Is there any way to speed up a query that has a between clause. For example, the following query takes about 20 ms.

select a.*, b.other_info
from address a, base b
where
a.street_name = 'TENNESSEE ST'
and
a.street_no = 2191
and
a.street_direction = 'W'
and
a.rid = b.rid
order by a.rid

But, the following, with a between clause, takes 5+ seconds...

select a.*, b.other_info
from address a, base b
where
a.street_name = 'TENNESSEE ST'
and
a.street_no between 2141 and 2241
and
a.street_direction = 'W'
and
a.rid = b.rid
order by a.rid

I currently have an index defined on street_name, street_no and a composite index on street_no, street_name.

Is there anyway to speed this up or are between clause just slow?

Thanks and Best Regards,

David Saracini Received on Thu May 09 2002 - 09:37:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US