Problem summary:
Server configuration: SQL Server 2008 R2 Sp2
Initial state:
We have several fact tables partitioned by a partitioning function. The partitioning function datatype is numeric and partition is done based on year. On the tables, we’ve been using nonclustered primary key and all the non clustered indexes are partition aligned. There are lots of foreign key reference to DIM tables from FACT tables. The ETL modifying these fact tables based on teh last week data change. Update is used to update the fact tables based on the primary key
Symptoms:
When loading the fact tables, especially the larger ones (wide tables with 30 to 50 columns, most of which are indexed dimensions), data modification to certain tables fails. The error message we get states “Cannot insert duplicate key row in object 'dbo.FACT TABLE' with unique index 'Index Name'”. The mentioned index is not unique although the message says so. But the primary key has unique primary key.By selecting the data we’ve been trying to insert we have checked that no duplicate unique data is being inserted.
Workaround:
Dropping all nonclustered indexes and then re-running the ETL to update the change dataand recreating the indexes works fine. The workaround is not acceptable in a daily manner due to size of the tables.
Server configuration: SQL Server 2008 R2 Sp2
Initial state:
We have several fact tables partitioned by a partitioning function. The partitioning function datatype is numeric and partition is done based on year. On the tables, we’ve been using nonclustered primary key and all the non clustered indexes are partition aligned. There are lots of foreign key reference to DIM tables from FACT tables. The ETL modifying these fact tables based on teh last week data change. Update is used to update the fact tables based on the primary key
Symptoms:
When loading the fact tables, especially the larger ones (wide tables with 30 to 50 columns, most of which are indexed dimensions), data modification to certain tables fails. The error message we get states “Cannot insert duplicate key row in object 'dbo.FACT TABLE' with unique index 'Index Name'”. The mentioned index is not unique although the message says so. But the primary key has unique primary key.By selecting the data we’ve been trying to insert we have checked that no duplicate unique data is being inserted.
Workaround:
Dropping all nonclustered indexes and then re-running the ETL to update the change dataand recreating the indexes works fine. The workaround is not acceptable in a daily manner due to size of the tables.