Skip to content

Commit 9ae380b

Browse files
authored
Merge pull request #120287 from dialmoth/patch-23
Update design-guidance-for-replicated-tables.md
2 parents 3b9e2c2 + 28741b7 commit 9ae380b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

articles/synapse-analytics/sql-data-warehouse/design-guidance-for-replicated-tables.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,29 @@ To trigger a rebuild, run the following statement on each table in the preceding
185185
SELECT TOP 1 * FROM [ReplicatedTable]
186186
```
187187

188+
> [!NOTE]
189+
> If you are planning to rebuild the statistics of the uncached replicated table, make sure to update the statistics before triggering the cache. Updating statistics will invalidate the cache, so the sequence is important.
190+
>
191+
> Example: Start with `UPDATE STATISTICS`, then trigger the rebuild of the cache. In the following examples, the correct sample updates the statistics then triggers the rebuild of the cache.
192+
>
193+
> ```sql
194+
> -- Incorrect sequence. Ensure that the rebuild operation is the last statement within the batch.
195+
> BEGIN
196+
> SELECT TOP 1 * FROM [ReplicatedTable]
197+
>
198+
> UPDATE STATISTICS [ReplicatedTable]
199+
> END
200+
> ```
201+
>
202+
> ```sql
203+
> -- Correct sequence. Ensure that the rebuild operation is the last statement within the batch.
204+
> BEGIN
205+
> UPDATE STATISTICS [ReplicatedTable]
206+
>
207+
> SELECT TOP 1 * FROM [ReplicatedTable]
208+
> END
209+
> ```
210+
188211
To monitor the rebuild process, you can use [sys.dm_pdw_exec_requests](/sql/relational-databases/system-dynamic-management-views/sys-dm-pdw-exec-requests-transact-sql?view=azure-sqldw-latest&preserve-view=true), where the `command` will start with 'BuildReplicatedTableCache'. For example:
189212
190213
```sql

0 commit comments

Comments
 (0)