Domanda

Moving some complicated reporting sprocs to a centralized server and time went from 5 seconds to 30+ seconds.

validating what take so long via:

print '04 NWA Raw data Numeric'
print datediff(ss, @now, getdate())
set @now = GETDATE()

I am attempting to only pull local what this report needs with these queries:

1355 rows in 10 seconds----

select * 
into #nwaDump
from [Phoenix].[NWA].dbo.QISDataNumeric
where rowguid in (
select rowguid from [Phoenix].[NWA].[dbo].[QISDataText] nd
where nd.DataValue in ( '41310291            ' ) 
)  

249 rows in 28 seconds

select * 
into #nwaText 
from [Phoenix].[NWA].[dbo].[QISDataText] td
where td.DataValue in ( '41310291            ' ) 

Same two queries run on other server < 1 second return time.

Any ideas?

È stato utile?

Soluzione

You can try to use OPENQUERY for this, since it should make the filters on the linked server and then pull them to your other server:

SELECT *
INTO #nwaText 
FROM OPENQUERY(Phoenix,'SELECT * FROM [NWA].[dbo].[QISDataText] 
                        WHERE DataValue in ( ''41310291            '' )')
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top