Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit d68c572

Browse files
authored
Merge pull request #21963 from mstehrani/patch-8
Revert
2 parents fef662d + a293d8b commit d68c572

1 file changed

Lines changed: 10 additions & 26 deletions

File tree

docs/t-sql/statements/merge-transact-sql.md

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -277,43 +277,27 @@ Specifies the graph match pattern. For more information about the arguments for
277277
>[!IMPORTANT]
278278
> 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.
279279
>
280-
> 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 in 2 cases:
281-
>
282-
> **Case 1**
280+
> 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:
281+
>
283282
> - The MERGE T-SQL statement was executed on a HASH distributed TARGET table in Azure Synapse SQL database AND
284283
> - The TARGET table of the MERGE has secondary indices or a UNIQUE constraint.
285284
>
286-
> **Case 2**
287-
> - The MERGE T-SQL statement updated a distribution key column of a HASH distributed table.
288-
>
289-
> **Case 1** has been fixed in Synapse SQL version ***10.0.15563.0*** and higher.
285+
> The problem has been fixed in Synapse SQL version ***10.0.15563.0*** and higher.
290286
> - 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.
291287
> - 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.
292288
> - This fix doesn't repair tables already affected by the MERGE problem. Use scripts below to identify and repair any affected tables manually.
293289
>
294-
> **Case 2** is pending fix.
295-
> - Until further notice, avoid using the MERGE command to update distribution key columns in HASH distributed tables.
296-
> - Use the scripts below to identify and repair any affected tables manually.
297-
>
298-
> To check which hash distributed tables in a database may be of concern (if used in the Cases above), run this statement
290+
> To check which hash distributed tables in a database cannot work with MERGE due to this issue, run this statement
299291
>```sql
300-
> -- Case 1
301292
> select a.name, c.distribution_policy_desc, b.type from sys.tables a join sys.indexes b
302293
> on a.object_id = b.object_id
303294
> join
304295
> sys.pdw_table_distribution_properties c
305296
> on a.object_id = c.object_id
306-
> where b.type = 2 and c.distribution_policy_desc = 'HASH';
307-
>
308-
> -- Subject to Case 2, if distribution key value is updated in MERGE statement
309-
> select a.name, c.distribution_policy_desc from sys.tables a
310-
> join
311-
> sys.pdw_table_distribution_properties c
312-
> on a.object_id = c.object_id
313-
> where c.distribution_policy_desc = 'HASH';
297+
> where b.type = 2 and c.distribution_policy_desc = 'HASH'
314298
> ```
315299
>
316-
> To check if a hash distributed table for MERGE is affected by either Case 1 or Case 2, follow these steps to examine if the tables have rows landed in wrong distribution. If 'no need for repair' is returned, this table is not affected.
300+
> To check if a hash distributed TARGET table for MERGE is affected by this issue, follow these steps to examine if the tables have rows landed in wrong distribution. If 'no need for repair' is returned, this table is not affected.
317301
>
318302
>```sql
319303
> if object_id('[check_table_1]', 'U') is not null
@@ -324,14 +308,14 @@ Specifies the graph match pattern. For more information about the arguments for
324308
> go
325309
>
326310
> create table [check_table_1] with(distribution = round_robin) as
327-
> select <DISTRIBUTION_COLUMN> as x from <MERGE_TABLE> group by <DISTRIBUTION_COLUMN>;
311+
> select <DISTRIBUTION_COLUMN> as x from <MERGE_TARGET_TABLE> group by <DISTRIBUTION_COLUMN>;
328312
> go
329313
>
330314
> create table [check_table_2] with(distribution = hash(x)) as
331315
> select x from [check_table_1];
332316
>go
333317
>
334-
> if not exists(select top 1 * from (select <DISTRIBUTION_COLUMN> as x from <MERGE_TABLE> except select x from
318+
> if not exists(select top 1 * from (select <DISTRIBUTION_COLUMN> as x from <MERGE_TARGET_TABLE> except select x from
335319
> [check_table_2]) as tmp)
336320
> select 'no need for repair' as result
337321
> else select 'needs repair' as result
@@ -352,10 +336,10 @@ Specifies the graph match pattern. For more information about the arguments for
352336
> if object_id('[repair_table]', 'U') is not null
353337
> drop table [repair_table];
354338
> go
355-
> create table [repair_table_temp] with(distribution = round_robin) as select * from <MERGE_TABLE>;
339+
> create table [repair_table_temp] with(distribution = round_robin) as select * from <MERGE_TARGET_TABLE>;
356340
> go
357341
>
358-
> -- [repair_table] will hold the repaired table generated from <MERGE_TABLE>
342+
> -- [repair_table] will hold the repaired table generated from <MERGE_TARGET_TABLE>
359343
> create table [repair_table] with(distribution = hash(<DISTRIBUTION_COLUMN>)) as select * from [repair_table_temp];
360344
> go
361345
>if object_id('[repair_table_temp]', 'U') is not null

0 commit comments

Comments
 (0)