Skip to content

Commit

Permalink
Merge pull request #18831 from XiaoyuMSFT/NewMergeUpdate
Browse files Browse the repository at this point in the history
New merge update
  • Loading branch information
PRMerger17 authored Mar 15, 2021
2 parents 14b98ca + ea70423 commit d8f5366
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions docs/t-sql/statements/merge-transact-sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Specifies the search conditions to specify \<merge_search_condition> or \<clause

\<graph search pattern>
Specifies the graph match pattern. For more information about the arguments for this clause, see [MATCH &#40;Transact-SQL&#41;](../../t-sql/queries/match-sql-graph.md)

## Remarks
>[!NOTE]
> In Azure Synapse Analytics, the MERGE command (preview) has following differences compared to SQL server and Azure SQL database.
Expand All @@ -242,15 +242,18 @@ Specifies the graph match pattern. For more information about the arguments for
>|**NOT MATCHED BY SOURCE**|All distribution types|All distribution types|||
>[!IMPORTANT]
> In Azure Synapse Analytics the MERGE command, currently in preview, may, under certain conditions, leave the target table in an inconsistent state, with rows placed in the wrong distribution, causing later queries to return wrong results in some cases. This problem may happen when these two conditions are met:
> Preview features are meant for testing only and should not be used on production instances or production data. Please also keep a copy of your test data if the data is important.
>
> - The MERGE T-SQL statement was executed on a HASH distributed TARGET table in Azure Synapse SQL database.
> - The TARGET table of the merge has secondary indices or a UNIQUE constraint.
> In Azure Synapse Analytics the MERGE command, currently in preview, may, under certain conditions, leave the target table in an inconsistent state, with rows placed in the wrong distribution, causing later queries to return wrong results in some cases. This problem may happen when these two conditions are met:
>
> Until the fix is available, avoid using the MERGE command on HASH distributed TARGET tables that have secondary indices or UNIQUE constraints. The MERGE feature support may also be temporarily disabled on databases with HASH distributed tables that have UNIQUE constraints or secondary indices.
> - The MERGE T-SQL statement was executed on a HASH distributed TARGET table in Azure Synapse SQL database AND
> - The TARGET table of the merge has secondary indices or a UNIQUE constraint.
>
> An important reminder, preview features are meant for testing only and should not be used on production instances or production data. Please also keep a copy of your test data if the data is important.
>
> The problem has been fixed in Synapse SQL version ***10.0.15563.0*** and higher.
> - To check, connect to the Synapse SQL database via SQL Server Management Studio (SSMS) and run ```SELECT @@VERSION```. If the fix has not been applied, manually pause and resume your Synapse SQL pool to get the fix.
> - Until the fix has been verified applied to your Synapse SQL pool, avoid using the MERGE command on HASH distributed TARGET tables that have secondary indices or UNIQUE constraints.
> - This fix doesn't repair tables already affected by the MERGE problem. Use scripts below to identify and repair any affected tables manually.
> To check which hash distributed tables in a database cannot work with MERGE due to this issue, run this statement
>```sql
> select a.name, c.distribution_policy_desc, b.type from sys.tables a join sys.indexes b
Expand Down

0 comments on commit d8f5366

Please sign in to comment.