I have these 2 tables with thousands of data and i will look for matches 1:1 on both tables. I have the query below, but when the limit is already beyond 1000 the return starts to slow down, it took almost an hour before I receive a result, I am using my local xampp as database for this and have a 4G(3.4G usable) RAM PC.
Is there any other way to enhance and make the query faster?
Thank you in advance for those who will help.
SELECT a.rNum,
a.cDate,
a.cTime,
a.aNumber,
a.bNumber,
a.duration,
a.tag,
a.aNumber2,
a.bNumber2,
'hasMatch',
a.concatDate,
a.timeMinutes
FROM tableOne a
INNER JOIN
tableTwo b ON a.aNumber2 = b.aNumber2
AND a.bNumber2 = b.bNumber2
WHERE a.hasMatch = 'valid'
AND (a.duration - b.duration) <= 3
AND (a.duration - b.duration) >= -3
AND TIMEDIFF(a.concatDate,b.concatDate) <= 3
AND TIMEDIFF(a.concatDate,b.concatDate) >= -3
LIMIT 0,100;