January 6, 2025 at 4:51 pm
So we have local sp in which remote table is udpated.this remote query part is 99% of cost of all sp (acrroding to execution plan).the sp does someting locally which i am skping as they are not factore right now ,but remote query part is.I have provide remote query and its execution plan.Accoring to execution plan its first scaning remote table to bring around 50Lakhs record then filerting lcoaly to reduce it to 25thousands rows and in last remote table is update .Kindly suggest how to tune this query so as to reduce cost or filetring to be done remotely instead locally .And all table has indexes.
why its filering locally but not remotelly ???
Belwo is query
Remotetable =RT
localtempteable =#lt
update RT
set RT.coloumnA = case when isnull(#lt.coloumnX,'')='' then 'sometinhsomething' else 'sometingelse'
from #lt inner join linkserver.remoteserver.remotedatbase with (rowlock) on #lt.coloumnB=RT.columnB
where RT.coloumnC='something'
and RT.coloumnD='something
January 7, 2025 at 5:06 pm
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
January 7, 2025 at 8:19 pm
Please post replies here: https://www.sqlservercentral.com/forums/topic/remote-query-is-taking-99-cost-of-local-sp-execution-2
Viewing 3 posts - 1 through 3 (of 3 total)
The topic ‘Remote query is taking 99% cost of local sp execution’ is closed to new replies.