SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Staging table population


Staging table population

Author
Message
dhanasekar.palani
dhanasekar.palani
SSC Journeyman
SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)

Group: General Forum Members
Points: 77 Visits: 175
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.
CozyRoc
CozyRoc
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3186 Visits: 2235
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/


DonaldW
DonaldW
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1484 Visits: 487
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. BigGrin

Don



Bruce W Cassidy
Bruce W Cassidy
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1723 Visits: 1033
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.
Phil Parkin
Phil Parkin
One Orange Chip
One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)

Group: General Forum Members
Points: 25660 Visits: 20678
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.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
Paul Williams
Paul Williams
SSChasing Mays
SSChasing Mays (637 reputation)SSChasing Mays (637 reputation)SSChasing Mays (637 reputation)SSChasing Mays (637 reputation)SSChasing Mays (637 reputation)SSChasing Mays (637 reputation)SSChasing Mays (637 reputation)SSChasing Mays (637 reputation)

Group: General Forum Members
Points: 637 Visits: 882
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.
Bruce W Cassidy
Bruce W Cassidy
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1723 Visits: 1033
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.

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search