Slow Linked Server Query

General PGNP discussions.

Slow Linked Server Query

Postby dcastro » Mon Feb 13, 2012 8:10 am

Hi,

I am trying to find out why a query that is in a view on a MS SQL 2008 server runs forever *I have waited over 10 minutes) while the SQL that makes up the view can be run directly against the Postgres DB in seconds.

View:
SELECT csf.callid, CAST(csf.segmentstarttime AS DATETIME) AS Start_Time, CAST(csf.segmentstoptime AS DATETIME) AS Stop_Time, csf.dialednumber AS First_VDN,
csf.callingparty AS Calling_Party, csf.dispositionkey AS Answering_Disposition, ad.sourcename, ad.acd, ad.agentname, csf.talktime, csf.queuetime, csf.duration,
csf.holdtime, csf.timeheld, ad.agentlogid, sd.skillnumber, sd.skillname
FROM [CS-ACASVR00].ahadatamart.[public].callsegmentfact AS csf INNER JOIN
[CS-ACASVR00].ahadatamart.[public].agentdim AS ad ON csf.answeringagentkey = ad.agentkey AND ad.sourceid > 0 INNER JOIN
[CS-ACASVR00].ahadatamart.[public].skilldim AS sd ON csf.dispositionskillkey = sd.skillkey
WHERE (ad.acd = 2)

Query off of view:
SELECT *
FROM [CallData].[dbo].[vACA_ACD2]
WHERE Start_Time BETWEEN '1/1/2012' AND '2/1/2012'

Query direct on Postgres from pgAdmin III:
SELECT csf.callid, csf.segmentstarttime AS Start_Time, csf.segmentstoptime AS Stop_Time, csf.dialednumber AS First_VDN, csf.callingparty AS Calling_Party,
csf.dispositionkey AS Answering_Disposition, ad.sourcename, ad.acd, ad.agentname, csf.talktime, csf.queuetime, csf.duration, csf.holdtime, csf.timeheld,
ad.agentlogid, sd.skillnumber, sd.skillname
FROM callsegmentfact AS csf INNER JOIN
agentdim AS ad ON csf.answeringagentkey = ad.agentkey AND ad.sourceid > 0 INNER JOIN
skilldim AS sd ON csf.dispositionskillkey = sd.skillkey
WHERE (ad.acd = 2)
AND segmentstarttime BETWEEN '1/1/2012' AND '2/1/2012'

I am thinking it is related to the time stamp field but I cannot be sure. We have other queries that run against this server fine.

Any help would be appreciated.


Thanks,

Dean
dcastro
 
Posts: 2
Joined: Tue May 17, 2011 8:01 am

Re: Slow Linked Server Query

Postby Moderator » Sun Feb 19, 2012 1:50 am

Hi Dean,
we are working on the issue.

Thank you!
User avatar
Moderator
Site Admin
 
Posts: 303
Joined: Wed Oct 29, 2008 11:27 pm


Return to Miscellaneous

Who is online

Users browsing this forum: No registered users and 1 guest