• 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.