January 16, 2017 at 4:51 am
I have a table that is partitioned by month, I'm loading the table from another table in batches of 1 million.
Starting from an empty destination the inserts take about 20 seconds per 1 million rows.
However by about 60million rows inserted the time jumps to 40 seconds per 1 million rows, and by the time the table is 100million rows its closer to 2 minutes.
As another note the data being inserted is sequential based on the partition column.
January 16, 2017 at 6:34 am
Looks like normal issues with loading onto cluster indexes.
As the table is partitioned the fastest way would be to populate staging tables per partition and then using the alter table ... switch partition to move the data onto the final table. Optionally even do the load in parallel for faster processing.
See https://www.brentozar.com/sql/table-partitioning-resources/ for some resources on this subject.
January 16, 2017 at 4:55 pm
mtaylor7210 63514 - Monday, January 16, 2017 4:51 AMI have a table that is partitioned by month, I'm loading the table from another table in batches of 1 million.
Starting from an empty destination the inserts take about 20 seconds per 1 million rows.
However by about 60million rows inserted the time jumps to 40 seconds per 1 million rows, and by the time the table is 100million rows its closer to 2 minutes.As another note the data being inserted is sequential based on the partition column.
Is the leading column of the Clustered Index the partition column? If not, then you've probably identified your problem. When I did such a transfer (I limited by month rather than by a fixed row count) to a partitioned table (>600GB), I saw no such slowdown. I was also sure to make it so that all of the non-Clustered indexes were partition aligned.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 29, 2020 at 6:40 am
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply