Hi experts,
i have this query that uses a linked server (from_ams) to connect to an oracle database. The query takes 12 minutes to run and I am just comparing about 10 records. I believe what is happening is the openquery is pulling every record from the oracle side which is millions of records. Is there any modifications I can make to this query to compare only the records in the WM_EME_to_AMS_PointsCompareFULL table?
sql query:
select a.HH_NUM, p.Amount, eme.HH_NUM, eme.emeBalance
from WM_EME_to_AMS_PointsCompareFULL a
join CardIDs b on CONVERT(bigint, b.ExtCardID) = a.HH_NUM and b.CardTypeID = 1
inner join points p on b.CustomerPK = p.CustomerPK and ProgramID = 1
inner join Openquery([from_ams], ' SELECT H.HH_NUM, H.SPTSACCU10 as emeBalance FROM EME.HOUSEHOLD H ' ) eme on a.HH_NUM = eme.hh_num
Our community of experts have been thoroughly vetted for their expertise and industry experience.