Bulk Insert to SQL Server gradually slows down

Gayan Dasanayake 1 Reputation point
2021-08-25T08:07:52.417+00:00

We are doing a basic ETL from Oracle to SQL Server using SSIS (Using a script component).

It is a basic read and bulk insert.

The insert is done in batches of 10,000.

When doing an ETL of 17million rows, we observe a steady decline in performance.
First batch taking 2 seconds but the last taking 132.

Any areas to look for solving?

Thanks

126249-image.png

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,865 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,579 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Tom Phillips 17,731 Reputation points
    2021-08-25T12:22:10.723+00:00

    What is your table definition?

    It is almost certainly due to updating indexes in batches of 10,000. As your table/indexes grow, it takes longer to update.

    10,000 is a very small batch. Try 100,000 to 500,000 row batch size.

    1 person found this answer helpful.
    0 comments No comments

  2. Erland Sommarskog 111.8K Reputation points MVP
    2021-08-25T21:43:55.25+00:00

    Tom mentioned indexes. Having the clustered index in place can help - at least if the data loaded is being aligned to it. But it is much better to create non-clustered indexes until after the load has completed.

    0 comments No comments

  3. ZoeHui-MSFT 36,666 Reputation points
    2021-08-26T06:13:37.283+00:00

    Hi @Gayan Dasanayake ,

    It could be many problems. See here for MSDN recommendations on optimizing bulk inserts. Try limiting the batches to say 10,000 or 100,000 rows and see how that goes. If it helps a lot then you should spend some time to figure out your best batch size.

    From SSIS side, here is a similar issue you may refer this to see if it will be helpful.

    Regards,

    Zoe


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    Hot issues October

    0 comments No comments

  4. Gayan Dasanayake 1 Reputation point
    2021-08-30T02:03:22.86+00:00

    We have found that when the Oracle oledb driver was changed from version 19.1 to 12.1 the issue was fixed.
    However, the batch size and index-related optimizations would still improve I assume, which we are investigating further.
    Thanks to all who helped.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.