Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have some SSIS packages wherein inside the DFTs the source task contains a sql query to fetch data from a database and then processed and then stored to another table.

But the problem is DFT is taking so much time to pull the rows into the buffer for processing, hence the execution times are going very high. So as an alternative, I kept that complex query into a stored procedure in SQL server and called it from the DFTs OLEDB Source task. To my surprise the DFT which took hours of time to execute now finished processing in matter of minutes !!

Now I am in a dilemma whether to go with stored procedures for all the packages also?? Any ideas which method is the best way to follow(Query or Proc ?). Please suggest. I searched in online to have some concrete explanation supporting which way is better, but I couldn't find any solid answer.

What I have tried:

Tried replacing Query with Stored proc, it showed tremendous improvements in execution time.
Posted
Comments
Nigam,Ashish 25-Apr-16 9:35am    
I think Proc is best way
CHill60 25-Apr-16 9:41am    
Why? Give the OP some reason to also think it is the best way
CHill60 25-Apr-16 9:39am    
I'm also surprised that you showed such a huge improvement. My own experience was so little difference as to not be noticeable. Historically SPs can cause other problems in Data Flow Tasks

See these links for further information:
Stored Procedure vs direct SQL command in SSIS data flow source - Stack Overflow[^]
Using SQL Server Stored Procedures in SSIS Data Flow Sources - SQLServerCentral[^]

You made no other changes other than putting the SQL into an SP?
dinesh42 30-Aug-16 8:48am    
I didn't do any changes, that query is running perfectly for quite some time but recently for the past few days it is behaving like that. Not sure what could be the reason and at the same time there is no much increase in the count of records that underlying tables have !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900