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

Staging table population Expand / Collapse
Author
Message
Posted Wednesday, January 28, 2009 5:17 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, September 15, 2011 1:18 PM
Points: 22, Visits: 152
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.
Post #645521
Posted Wednesday, January 28, 2009 10:56 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 7:04 PM
Points: 1,114, Visits: 2,192
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?


---
SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

Post #645599
Posted Friday, January 30, 2009 7:57 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Sunday, October 20, 2013 7:52 PM
Points: 1,310, Visits: 483
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. :D

Don



Post #646968
Posted Sunday, February 01, 2009 1:55 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, April 01, 2014 5:55 PM
Points: 957, Visits: 1,027
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.
Post #647754
Posted Sunday, February 01, 2009 7:37 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Yesterday @ 4:41 AM
Points: 4,828, Visits: 11,180
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



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #647779
Posted Wednesday, February 04, 2009 11:42 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: 2 days ago @ 2:21 AM
Points: 533, Visits: 665
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.
Post #650162
Posted Wednesday, February 04, 2009 1:21 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, April 01, 2014 5:55 PM
Points: 957, Visits: 1,027
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.
Post #650288
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse