Improving performance of a query that uses BETWEEN
I have a query that uses the BETWEEN operator and is performing VERY slow. Basically, I have a TABLE_A that contains an integer, I'm trying to find the ONE record in TABLE_B in which that integer falls between a BEGIN and END integer value. Think of it similar to finding a date that falls between a begin date and an end date (although these are integers, not dates). The two tables are very large, containing over 100 million records each.
My existing slow query looks like this:
SELECT A.*
FROM
TABLE_A A,
TABLE_B B
WHERE
A.INT_NO BETWEEN B.INT_BEGIN AND B.INT_END;
0