Skip to content

Commit 0a65324

Browse files
authored
Merge pull request #18326 from WilliamDAssafMSFT/20210122-detail-ONLINE-table-compression
20210122 detail online table compression
2 parents b49ea1f + bb38e74 commit 0a65324

1 file changed

Lines changed: 29 additions & 30 deletions

File tree

docs/relational-databases/data-compression/enable-compression-on-a-table-or-index.md

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: "Enable Compression on a Table or Index | Microsoft Docs"
2+
title: "Enable Compression on a Table or Index"
33
description: Learn how to enable compression on a table or index in SQL Server by using SQL Server Management Studio or Transact-SQL.
44
ms.custom: ""
5-
ms.date: "03/14/2017"
5+
ms.date: "01/22/2021"
66
ms.prod: sql
77
ms.reviewer: ""
88
ms.prod_service: database-engine, sql-database, sql-data-warehouse, pdw
@@ -20,7 +20,6 @@ f1_keywords:
2020
helpviewer_keywords:
2121
- "data compression wizard"
2222
- "compression [SQL Server], enable"
23-
ms.assetid: b7442cff-e616-475a-9c5a-5a765089e5f2
2423
author: WilliamDAssafMSFT
2524
ms.author: wiassaf
2625
monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest || >= sql-server-2016"
@@ -29,9 +28,9 @@ monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest |
2928

3029
[!INCLUDE[SQL Server Azure SQL Database Synapse Analytics PDW ](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
3130

32-
This topic describes how to enable compression on a table or index in [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] by using [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] or [!INCLUDE[tsql](../../includes/tsql-md.md)].
31+
This article describes how to enable [data compression](../../relational-databases/data-compression/data-compression.md) on a table or index in [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] by using [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] or [!INCLUDE[tsql](../../includes/tsql-md.md)].
3332

34-
**In This Topic**
33+
**In this article**
3534

3635
- **Before you begin:**
3736

@@ -51,7 +50,7 @@ monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest |
5150

5251
- System tables cannot be enabled for compression.
5352

54-
- If the table is a heap, the rebuild operation for ONLINE mode will be single threaded. Use OFFLINE mode for a multi-threaded heap rebuild operation. For a more information about data compression, see [Data Compression](../../relational-databases/data-compression/data-compression.md).
53+
- If the table is a heap, the rebuild operation for ONLINE mode will be single threaded. Use OFFLINE mode for a multi-threaded heap rebuild operation. Rebuild operations are OFFLINE unless you specify the ONLINE option. For complete information on performing an ONLINE rebuild, see [Perform Index Operations Online](../indexes/perform-index-operations-online.md).
5554

5655
- You cannot change the compression setting of a single partition if the table has nonaligned indexes.
5756

@@ -70,9 +69,9 @@ monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest |
7069

7170
3. Right-click the table or index to compress, point to **Storage** and select **Manage Compression...**.
7271

73-
4. In the Data Compression Wizard, on the **Welcome to the Data Compression Wizard** page, click **Next**.
72+
4. In the Data Compression Wizard, on the **Welcome to the Data Compression Wizard** page, select **Next**.
7473

75-
5. On the **Select Compression Type** page, select the compression type to apply to each partition in the table or index you want to compress. When finished, click **Next**.
74+
5. On the **Select Compression Type** page, select the compression type to apply to each partition in the table or index you want to compress. When finished, select **Next**.
7675

7776
The following options are available on the **Select Compression Type** page:
7877

@@ -95,25 +94,25 @@ monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest |
9594
Displays the current space this partition occupies in megabytes (MB). This column is read-only.
9695

9796
**Requested Compressed Space**
98-
After you click **Calculate**, this column displays the estimated size of each partition after compression by using the setting specified in the **Compression Type** column. This column is read-only.
97+
After you select **Calculate**, this column displays the estimated size of each partition after compression by using the setting specified in the **Compression Type** column. This column is read-only.
9998

10099
**Calculate**
101-
Click to estimate the size of each partition after compression by using the setting specified in the **Compression Type** column.
100+
Select to estimate the size of each partition after compression by using the setting specified in the **Compression Type** column.
102101

103102
6. In the **Select an Output Option** page, specify how you want to complete your compression. Select **Create Script** to create a SQL script based the previous pages in the wizard. Select **Run immediately** to create the new partitioned table after completing all remaining pages in the wizard. Select **Schedule** to create the new partitioned table at a predetermined time in the future.
104103

105104
If you select **Create script**, the following options are available under **Script options**:
106105

107106
**Script to file**
108-
Generates the script as a .sql file. Enter a file name and location in the **File name** box or click **Browse** to open the **Script File Location** dialog box. From **Save As**, select **Unicode text** or **ANSI text**.
107+
Generates the script as a .sql file. Enter a file name and location in the **File name** box or select **Browse** to open the **Script File Location** dialog box. From **Save As**, select **Unicode text** or **ANSI text**.
109108

110109
**Script to Clipboard**
111110
Saves the script to the Clipboard.
112111

113112
**Script to New Query Window**
114113
Generates the script to a new Query Editor window. This is the default selection.
115114

116-
If you select **Schedule**, click **Change schedule**.
115+
If you select **Schedule**, select **Change schedule**.
117116

118117
1. In the **New Job Schedule** dialog box, in the **Name** box, enter the job schedule's name.
119118

@@ -123,9 +122,9 @@ monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest |
123122

124123
- **Start whenever the CPUs become idle**
125124

126-
- **Recurring**. Select this option if your new partitioned table updates with new information on a regular basis.
125+
- **Recurring**. Select this option if your new partitioned table updates with new information regularly.
127126

128-
- **One time**. This is the default selection.
127+
- **One time**. This option is the default selection.
129128

130129
3. Select or clear the **Enabled** check box to enable or disable the schedule.
131130

@@ -139,15 +138,15 @@ monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest |
139138

140139
- If you select **Monthly**, select either **Day** or **The**.
141140

142-
- If you select **Day**, enter both the date of the month you want the job schedule to run and how often the job schedule repeats in months. For example, if you want the job schedule to run on the 15th day of the month every other month, select **Day** and enter "15" in the first box and "2" in the second box. Please note that the largest number allowed in the second box is "99".
141+
- If you select **Day**, enter both the date of the month you want the job schedule to run and how often the job schedule repeats in months. For example, if you want the job schedule to run on the 15th day of the month every other month, select **Day** and enter "15" in the first box and "2" in the second box. Note that the largest number allowed in the second box is "99".
143142

144-
- If you select **The**, select the specific day of the week within the month that you want the job schedule to run and how often the job schedule repeats in months. For example, if you want the job schedule to run on the last weekday of the month every other month, select **Day**, select **last** from the first list and **weekday** from the second list, and then enter "2" in the last box. You can also select **first**, **second**, **third**, or **fourth**, as well as specific weekdays (for example: Sunday or Wednesday) from the first two lists. Please note that the largest number allowed in the last box is "99".
143+
- If you select **The**, select the specific day of the week within the month that you want the job schedule to run and how often the job schedule repeats in months. For example, if you want the job schedule to run on the last weekday of the month every other month, select **Day**, select **last** from the first list and **weekday** from the second list, and then enter "2" in the last box. You can also select **first**, **second**, **third**, or **fourth**, as well as specific weekdays (for example: Sunday or Wednesday) from the first two lists. Note that the largest number allowed in the last box is "99".
145144

146145
2. Under **Daily frequency**, specify how often the job schedule repeats on the day the job schedule runs:
147146

148147
- If you select **Occurs once at**, enter the specific time of day when the job schedule should run in the **Occurs once at** box. Enter the hour, minute, and second of the day, as well as AM or PM.
149148

150-
- If you select **Occurs every**, specify how often the job schedule runs during the day chosen under **Frequency**. For example, if you want the job schedule to repeat every 2 hours during the day that the job schedule is run, select **Occurs every**, enter "2" in the first box, and then select **hour(s)** from the list. From this list you can also select **minute(s)** and **second(s)**. Please note that the largest number allowed in the first box is "100".
149+
- If you select **Occurs every**, specify how often the job schedule runs during the day chosen under **Frequency**. For example, if you want the job schedule to repeat every 2 hours during the day that the job schedule is run, select **Occurs every**, enter "2" in the first box, and then select **hour(s)** from the list. From this list you can also select **minute(s)** and **second(s)**. Note that the largest number allowed in the first box is "100".
151150

152151
In the **Starting at** box, enter the time that the job schedule should start running. In the **Ending at** box, enter the time that the job schedule should stop repeating. Enter the hour, minute, and second of the day, as well as AM or PM.
153152

@@ -157,11 +156,11 @@ monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest |
157156

158157
6. Under **Summary**, in **Description**, verify that all job schedule settings are correct.
159158

160-
7. Click **OK**.
159+
7. Select **OK**.
161160

162-
After completing this page, click **Next**.
161+
After completing this page, select **Next**.
163162

164-
7. On the **Review Summary** page, under **Review your selections**, expand all available options to verify that all compression settings are correct. If everything is as expected, click **Finish**.
163+
7. On the **Review Summary** page, under **Review your selections**, expand all available options to verify that all compression settings are correct. If everything is as expected, select **Finish**.
165164

166165
8. On the **Compression Wizard Progress** page, monitor status information about the actions of the Create Partition Wizard. Depending on the options that you selected in the wizard, the progress page might contain one or more actions. The top box displays the overall status of the wizard and the number of status, error, and warning messages that the wizard has received.
167166

@@ -194,7 +193,7 @@ monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest |
194193
**Send Report as Email**
195194
Copies the results of the wizard's progress report into an email message.
196195

197-
When complete, click **Close**.
196+
When complete, select **Close**.
198197

199198
## <a name="TsqlProcedure"></a> Using Transact-SQL
200199

@@ -206,9 +205,9 @@ In SQL Server, run `sp_estimate_data_compression_savings` and then enable compre
206205

207206
1. In **Object Explorer**, connect to an instance of [!INCLUDE[ssDE](../../includes/ssde-md.md)].
208207

209-
2. On the Standard bar, click **New Query**.
208+
2. On the Standard bar, select **New Query**.
210209

211-
3. Copy and paste the following example into the query window and click **Execute**. The example first executes the stored procedure `sp_estimate_data_compression_savings` to return the estimated size of the object if it were to use the ROW compression setting. The example then enables ROW compression on all partitions in the specified table.
210+
3. Copy and paste the following example into the query window and select **Execute**. The example first executes the stored procedure `sp_estimate_data_compression_savings` to return the estimated size of the object if it were to use the ROW compression setting. The example then enables ROW compression on all partitions in the specified table.
212211

213212
```sql
214213
USE AdventureWorks2012;
@@ -224,9 +223,9 @@ In SQL Server, run `sp_estimate_data_compression_savings` and then enable compre
224223

225224
1. In **Object Explorer**, connect to an instance of [!INCLUDE[ssDE](../../includes/ssde-md.md)].
226225

227-
2. On the Standard bar, click **New Query**.
226+
2. On the Standard bar, select **New Query**.
228227

229-
3. Copy and paste the following example into the query window and click **Execute**. The example first queries the `sys.indexes` catalog view to return the name and `index_id` for each index on the `Production.TransactionHistory` table. It then executes the stored procedure `sp_estimate_data_compression_savings` to return the estimated size of the specified index ID if it were to use the PAGE compression setting. Finally, the example rebuilds index ID 2 (`IX_TransactionHistory_ProductID`), specifying PAGE compression.
228+
3. Copy and paste the following example into the query window and select **Execute**. The example first queries the `sys.indexes` catalog view to return the name and `index_id` for each index on the `Production.TransactionHistory` table. It then executes the stored procedure `sp_estimate_data_compression_savings` to return the estimated size of the specified index ID if it were to use the PAGE compression setting. Finally, the example rebuilds index ID 2 (`IX_TransactionHistory_ProductID`), specifying PAGE compression.
230229

231230
```sql
232231
USE AdventureWorks2012;
@@ -248,15 +247,15 @@ In SQL Server, run `sp_estimate_data_compression_savings` and then enable compre
248247

249248
### On Azure SQL Database
250249

251-
Azure SQL Database does not support `sp_estimate_data_compression`. The following scripts enable compression without estimating the compression amount.
250+
Azure SQL Database does not support the `sp_estimate_data_compression_savings` stored procedure. The following scripts enable compression without estimating the compression amount.
252251

253252
#### To enable compression on a table
254253

255254
1. In **Object Explorer**, connect to an instance of [!INCLUDE[ssDE](../../includes/ssde-md.md)].
256255

257-
2. On the Standard bar, click **New Query**.
256+
2. On the Standard bar, select **New Query**.
258257

259-
3. Copy and paste the following example into the query window and click **Execute**. The example enables ROW compression on all partitions in the specified table.
258+
3. Copy and paste the following example into the query window and select **Execute**. The example enables ROW compression on all partitions in the specified table.
260259

261260
```sql
262261
USE AdventureWorks2012;
@@ -271,9 +270,9 @@ Azure SQL Database does not support `sp_estimate_data_compression`. The followin
271270

272271
1. In **Object Explorer**, connect to an instance of [!INCLUDE[ssDE](../../includes/ssde-md.md)].
273272

274-
2. On the Standard bar, click **New Query**.
273+
2. On the Standard bar, select **New Query**.
275274

276-
3. Copy and paste the following example into the query window and click **Execute**. The example first queries the `sys.indexes` catalog view to return the name and `index_id` for each index on the `Production.TransactionHistory` table. Finally, the example rebuilds index ID 2 (`IX_TransactionHistory_ProductID`), specifying PAGE compression.
275+
3. Copy and paste the following example into the query window and select **Execute**. The example first queries the `sys.indexes` catalog view to return the name and `index_id` for each index on the `Production.TransactionHistory` table. Finally, the example rebuilds index ID 2 (`IX_TransactionHistory_ProductID`), specifying PAGE compression.
277276

278277
```sql
279278
USE AdventureWorks2012;

0 commit comments

Comments
 (0)