Skip to content

Commit 4806304

Browse files
committed
fixing isues from reviewer.
1 parent 078d31b commit 4806304

File tree

1 file changed

+26
-30
lines changed

1 file changed

+26
-30
lines changed

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

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ Consider using a replicated table when:
4141
- The table size on disk is less than 2 GB, regardless of the number of rows. To find the size of a table, you can use the [DBCC PDW_SHOWSPACEUSED](https://docs.microsoft.com/sql/t-sql/database-console-commands/dbcc-pdw-showspaceused-transact-sql) command: `DBCC PDW_SHOWSPACEUSED('ReplTableCandidate')`.
4242
- The table is used in joins that would otherwise require data movem'nt. When joining tables that are not distributed on the same column, such as a hash-distributed table to a round-robin table, data movement is required to complete the query. If one of the tables is small, consider a replicated table. We recommend using replicated tables instead of round-robin tables in most cases. To view data movement operations in query plans, use [sys.dm_pdw_request_steps](https://docs.microsoft.com/sql/relational-databases/system-dynamic-management-views/sys-dm-pdw-request-steps-transact-sql). The BroadcastMoveOperation is the typical data movement operation that can be eliminated by using a replicated table.
4343

44-
Replicated tables may not yield the best query'performance when:
44+
Replicated tables may not yield the best query performance when:
4545

46-
- The table has frequent insert, update, and delete operations. Thes' data manipulation language (DML) operations require a rebuild of the replicated table. Rebuilding frequently can cause slower performance.
46+
- The table has frequent insert, update, and delete operations. The data manipulation language (DML) operations require a rebuild of the replicated table. Rebuilding frequently can cause slower performance.
4747
- The SQL Analytics database is scaled frequently. Scaling a SQL Analytics database changes the number of Compute nodes, which incurs rebuilding the replicated table.
4848
- The table has a large number of columns, but data operations typically access only a small number of columns. In this scenario, instead of replicating the entire table, it might be more effective to distribute the table, and then create an index on the frequently accessed columns. When a query requires data movement, SQL Analytics only moves data for the requested columns.
4949

@@ -65,31 +65,31 @@ WHERE EnglishDescription LIKE '%frame%comfortable%'
6565

6666
```
6767
68-
# Convert existing round-robin tables to replicated tables
69-
you already have round-robin tables, we recommend converting them to replicated tables if they meet the criteria outlined in this article. Replicated tables improve performance over round-robin tables because they eliminate the need for data movement.  A round-robin table always requires data movement for joins. '
70-
71-
his example uses [CTAS](/sql/t-sql/statements/create-ta'le-as-select-azure-sql-data-warehouse) to change the DimSalesTerritory table to a replicated table. This example works regardless of whether DimSalesTerritory is hash-distributed or round-robin.
72-
73-
``sql
74-
REATE TABLE [dbo].[DimSalesTerritory_REPLICATE]
75-
ITH
76-
(
77-
CLUSTERED COLUMNSTORE INDEX,
78-
DISTRIBUTION = REPLICATE
79-
)
80-
S SELECT * FROM [dbo].[DimSalesTerritory]
81-
PTION (LABEL = 'CTAS : DimSalesTerritory_REPLICATE')
82-
83-
- Switch table names
84-
ENAME OBJECT [dbo].[DimSalesTerritory] to [DimSalesTerritory_old];
85-
ENAME OBJECT [dbo'.[DimSalesTerrit'ry_REPLICATE] TO [DimSalesTerritory];
86-
87-
ROP TABLE [dbo].[DimSalesTerritory_old];
88-
``
68+
## Convert existing round-robin tables to replicated tables
69+
If you already have round-robin tables, we recommend converting them to replicated tables if they meet the criteria outlined in this article. Replicated tables improve performance over round-robin tables because they eliminate the need for data movement. A round-robin table always requires data movement for joins.
70+
71+
This example uses [CTAS](/sql/t-sql/statements/create-table-as-select-azure-sql-data-warehouse) to change the DimSalesTerritory table to a replicated table. This example works regardless of whether DimSalesTerritory is hash-distributed or round-robin.
72+
73+
```sql
74+
CREATE TABLE [dbo].[DimSalesTerritory_REPLICATE]
75+
WITH
76+
(
77+
CLUSTERED COLUMNSTORE INDEX,
78+
DISTRIBUTION = REPLICATE
79+
)
80+
AS SELECT * FROM [dbo].[DimSalesTerritory]
81+
OPTION (LABEL = 'CTAS : DimSalesTerritory_REPLICATE')
82+
83+
-- Switch table names
84+
RENAME OBJECT [dbo].[DimSalesTerritory] to [DimSalesTerritory_old];
85+
RENAME OBJECT [dbo].[DimSalesTerritory_REPLICATE] TO [DimSalesTerritory];
86+
87+
DROP TABLE [dbo].[DimSalesTerritory_old];
88+
```
8989

90-
## Query performance example for round-robin versus replicated
90+
### Query performance example for round-robin versus replicated
9191

92-
replicated table does not require any data movement for joins because the entire table is already present on each Compute node. If the dimension tables are round-robin distributed, a join copies the dimension table in full to each Compute node. To move the data, the query plan contains an operation called BroadcastMoveOperation. This type of data movement operation slows query performance and is eliminated by using replicated tables. To view query plan steps, use the [sys.dm_pdw_request_steps](/sql/relational-databases/system-dynamic-management-views/sys-dm-pdw-request-steps-transact-sql) system catalog view.
92+
A replicated table does not require any data movement for joins because the entire table is already present on each Compute node. If the dimension tables are round-robin distributed, a join copies the dimension table in full to each Compute node. To move the data, the query plan contains an operation called BroadcastMoveOperation. This type of data movement operation slows query performance and is eliminated by using replicated tables. To view query plan steps, use the [sys.dm_pdw_request_steps](/sql/relational-databases/system-dynamic-management-views/sys-dm-pdw-request-steps-transact-sql) system catalog view.
9393

9494
For example, in following query against the AdventureWorks schema, the `FactInternetSales` table is hash-distributed. The `DimDate` and `DimSalesTerritory` tables are smaller dimension tables. This query returns the total sales in North America for fiscal year 2004:
9595

@@ -132,7 +132,7 @@ Standard indexing practices apply to replicated tables. SQL Analytics rebuilds e
132132
### Batch data loads
133133
When loading data into replicated tables, try to minimize rebuilds by batching loads together. Perform all the batched loads before running select statements.
134134

135-
or example, this load pattern loads data from four sources and invokes four rebuilds. ''
135+
For example, this load pattern loads data from four sources and invokes four rebuilds.
136136

137137
Load from source 1.
138138
- Select statement triggers rebuild 1.
@@ -181,7 +181,3 @@ To create a replicated table, use one of these statements:
181181
- [CREATE TABLE AS SELECT (SQL Analytics)](/sql/t-sql/statements/create-table-as-select-azure-sql-data-warehouse)
182182

183183
For an overview of distributed tables, see [distributed tables](sql-data-warehouse-tables-distribute.md).
184-
185-
186-
187-
""""

0 commit comments

Comments
 (0)