RichardHayes
Programmer
I am finding a cross-product (Cartesian) query I have designed very slow to run. The only join I can impose on the two tables is that values lie within a range of other values. The other problem is one table has over a million records and the other in order of hundreds of thousands.
Any tips on how to speed this up?
SELECT
a.ID
,a.Value1
,a.Value2
,b.ID
,b.Value1
,b.Value2
FROM
a
,b
WHERE
ABS(a.Value1 - b.Value1) <= 1
AND ABS(a.Value2 - b.Value2) <= 1
Any tips on how to speed this up?
SELECT
a.ID
,a.Value1
,a.Value2
,b.ID
,b.Value1
,b.Value2
FROM
a
,b
WHERE
ABS(a.Value1 - b.Value1) <= 1
AND ABS(a.Value2 - b.Value2) <= 1