Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Very strange performance issue Expand / Collapse
Author
Message
Posted Friday, August 16, 2013 5:05 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, July 21, 2014 3:43 PM
Points: 1,274, Visits: 2,936

I have a simple query, if i run that query from SSMS it takes about 10 mins and if i run the same query as a exec sql task inside SSIS package takes less than 3 mins? I am clearing the buffers after each execution, and yes the source connection strings are the same. I am logged in the server and testing using SSMS and SSIS. Is there any reason why it is faster from SSIS? Query returns about 20 million records


SELECT * FROM vwActivities WHERE
CreatedDateKey>=20130101 and Fde='A123'


Post #1485418
Posted Saturday, August 17, 2013 6:33 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 2:28 PM
Points: 786, Visits: 691
20 million rows? It will take SSMS quite some time to render all those rows, particularly if you have results set to grid!

Erland Sommarskog, SQL Server MVP, www.sommarskog.se
Post #1485478
Posted Saturday, August 17, 2013 7:40 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 12:11 PM
Points: 42,470, Visits: 35,541
Short answer: SSMS is incredibly inefficient at displaying rows.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1485487
Posted Saturday, August 17, 2013 7:09 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 8:06 PM
Points: 36,786, Visits: 31,243
curious_sqldba (8/16/2013)

I have a simple query, if i run that query from SSMS it takes about 10 mins and if i run the same query as a exec sql task inside SSIS package takes less than 3 mins? I am clearing the buffers after each execution, and yes the source connection strings are the same. I am logged in the server and testing using SSMS and SSIS. Is there any reason why it is faster from SSIS? Query returns about 20 million records


SELECT * FROM vwActivities WHERE
CreatedDateKey>=20130101 and Fde='A123'




I guess I'd have to ask where you're putting the results for that query because I sure can't imagine returning 20 million rows to the screen... ever! I guess I'd also be curious why you're using an integer to represent a date/time unless the intent is to export to a file.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1485537
Posted Sunday, August 18, 2013 9:24 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, July 15, 2014 6:13 AM
Points: 307, Visits: 475
curious_sqldba (8/16/2013)

I have a simple query, if i run that query from SSMS it takes about 10 mins and if i run the same query as a exec sql task inside SSIS package takes less than 3 mins? I am clearing the buffers after each execution, and yes the source connection strings are the same. I am logged in the server and testing using SSMS and SSIS. Is there any reason why it is faster from SSIS? Query returns about 20 million records


SELECT * FROM vwActivities WHERE
CreatedDateKey>=20130101 and Fde='A123'




A SELECT * query is also extremely inefficient. You are returning 20m rows and SQL Server has to touch every row and every field inorder to return the results you are looking for.

Have you used the SQL Profiler to see if the execution plans Show up anything obvious? In this case I would suggest performing a server-side trace because I could easily imagine running the query inside the GUI (in your case the SSMS) is affecting the Overall Performance of the query.
Post #1485591
Posted Sunday, August 18, 2013 11:16 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 8:06 PM
Points: 36,786, Visits: 31,243
Even if it coud be done efficiently, I'd still like to know why someone is building a result set that contains 20 million rows.

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1485601
Posted Sunday, August 18, 2013 11:27 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 2:28 PM
Points: 786, Visits: 691
Jeff Moden (8/18/2013)
Even if it coud be done efficiently, I'd still like to know why someone is building a result set that contains 20 million rows.


So Curious_sqldba did mention that he also ran the query in SSIS. I assume that he exporting the data. For which, of course, SSMS is not a good tool.


Erland Sommarskog, SQL Server MVP, www.sommarskog.se
Post #1485604
Posted Sunday, August 18, 2013 12:12 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 8:06 PM
Points: 36,786, Visits: 31,243
Erland Sommarskog (8/18/2013)
Jeff Moden (8/18/2013)
Even if it coud be done efficiently, I'd still like to know why someone is building a result set that contains 20 million rows.


So Curious_sqldba did mention that he also ran the query in SSIS. I assume that he exporting the data. For which, of course, SSMS is not a good tool.


Agreed... that's why I hate to assume and asked the question.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1485609
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse