Columnstore index blocking/ lock with SSIS

panlondon1 21 Reputation points
2023-05-11T12:03:07.7666667+00:00
A blocking/ locking situation within SSIS for columnstore indexes only. We are talking about 15K rows insertion so very small. Even 1000 rows can cause the issue
1.
The below inserts into TableTR and never completes. This is a simple SSIS Dataflow task.
Select *  from Table1 a
    inner join dbo.TableTR tr with (nolock) on a.[Transaction Reference Number] = tr.[Transaction Reference Number]
                 and a.[Submitting Entity ID] = tr.[Submitting Entity ID]
                 and a.[Executing Entity ID] = tr.[Executing Entity ID]
  where tr.[Current_Flag] = 1

2.
Now if I do insert into TableTR_copy 
Select *  from Table1 a
    inner join dbo.TableTR tr with (nolock) on a.[Transaction Reference Number] = tr.[Transaction Reference Number]
                 and a.[Submitting Entity ID] = tr.[Submitting Entity ID]
                 and a.[Executing Entity ID] = tr.[Executing Entity ID]
  where tr.[Current_Flag] = 1


Then insert into  TableTR 
Select * from TableTR_copy that works fine with the columnstore.

No 2 works absolutely fine and is very quick.

No 1 only works if I drop the column store. So appears to be a block on the select caused by the insertion. I have managed to fix the issue by unclicking this flag below. This works fine if there is no columnstore index on the table. I can see the block spid on sp_who2. Very bizarre and can't see why a columnstore should cause this.


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,634 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,560 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. panlondon1 21 Reputation points
    2023-05-11T12:05:00.83+00:00

    This works fine by un-ticking this or by creating an aggregation before the insertion into the columnstore table. Could be other possible workarounds. Any ideas why a columnstore index is creating this? There is another index on the table no issues.

    User's image

    0 comments No comments

  2. Erland Sommarskog 109.8K Reputation points MVP
    2023-05-11T21:33:05.2433333+00:00

    What does "SELECT @@version" report?

    As I understand your post, sp_who and sp__who2 indicates blocking. Have you investigated what the blocking process is doing?

    Since you are requesting a table lock, this mean any query running against the table will block you.


  3. ZoeHui-MSFT 36,111 Reputation points
    2023-05-12T07:13:42.4166667+00:00

    Hi @panlondon1,

    Table lock
    Specify whether the table is locked during the load. The default value of this property is true.

    The table lock will block other processes using the table, including the other OLEDB Destinations within the SSIS package. Please have a double check.

    Regards,

    Zoe Hui


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

    0 comments No comments

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.