January 28, 2009 at 5:17 pm
I have a main table which has 55 million rows..I am populating a staging table from the main table with the conditions as from date to date...I wrote this staging table pouplation in a stored procedure and I called the stored Procedure in the integration services..But it is taking almost 40 minutes to complete the execution of the prcoedure.. this main table is indexed. Can any one give some idea how to reduce the execution of the procedure.Is there any way that I can put in the integration services so that the insertion to staging table is much faster....Please advise.
January 28, 2009 at 10:56 pm
dhanasekar.palani (1/28/2009)
I have a main table which has 55 million rows..I am populating a staging table from the main table with the conditions as from date to date...I wrote this staging table pouplation in a stored procedure and I called the stored Procedure in the integration services..But it is taking almost 40 minutes to complete the execution of the prcoedure.. this main table is indexed. Can any one give some idea how to reduce the execution of the procedure.Is there any way that I can put in the integration services so that the insertion to staging table is much faster....Please advise.
Do you know how many rows you have in the staging table as a result of the insertion? Is the staging table indexed too? Did you check the execution plan for the query you are running?
January 30, 2009 at 7:57 am
dhanasekar.palani (1/28/2009)
I have a main table which has 55 million rows..I am populating a staging table from the main table with the conditions as from date to date...I wrote this staging table pouplation in a stored procedure and I called the stored Procedure in the integration services..But it is taking almost 40 minutes to complete the execution of the prcoedure.. this main table is indexed. Can any one give some idea how to reduce the execution of the procedure.Is there any way that I can put in the integration services so that the insertion to staging table is much faster....Please advise.
If the staging table does not have to exist prior to the insert (for example, you have to insert some other rows first) try using a Select Into... instead of an Insert Into. This will create the table when you run the query and you can create any required indexes, etc, afterwards.
I had a similar situation a couple of years ago and making this changed reduced the processing time from over nine hours to about fifteen minutes. Your mileage may vary. 😀
Don
February 1, 2009 at 1:55 pm
[font="Verdana"]If you post the code you have in the stored procedure, and some details on what the indexing on the tables are, we can look at ideas for optimisation.[/font]
February 1, 2009 at 7:37 pm
I suggest that you concentrate on getting the sp working fast on its own without worrying about SSIS for now.
You should try to work out where the bottleneck is: is it in the selection of data from the main table, or in the writing of data to the staging table?
If you are writing millions of rows to the staging table, you may improve performance by writing them in batches - say 100,000 at a time.
Phil
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
February 4, 2009 at 11:42 am
It's not really of any benefit to write the import routine in an sp., and then run that from within SSIS as you are not taking advantage of any of the benefits of SSIS (such as in-memory usage and the components), you may as well just run the sp from a script or similar. I doubt you will see any difference in performance.
If you are familiar with SSIS, try re-writing the import routine to use SSIS functionality. Second ensure the table you are inserting to has no indexes. Importing into a heap and then re-creating the index will provide speeds of up to x10 faster than inserting into an indexed table.
Paul R Williams.
February 4, 2009 at 1:21 pm
[font="Verdana"]It can depend on the indexes on the table you are inserting into as well. If it is heavily indexes, this will slow down the insert.
Try dropping all but clustered index, inserting, recreating other indexes.
[/font]
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply