Skip to content

Commit ffdfd8e

Browse files
committed
Remove section on Azure SQL database and refresh SP article (addresses PR 9799)
1 parent 6a983a0 commit ffdfd8e

2 files changed

Lines changed: 89 additions & 70 deletions

File tree

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

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to enable compression on a table or index in SQL Server b
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
66
ms.reviewer: randolphwest
7-
ms.date: 08/21/2023
7+
ms.date: 06/10/2024
88
ms.service: sql
99
ms.subservice: performance
1010
ms.topic: conceptual
@@ -28,7 +28,7 @@ monikerRange: ">=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >
2828

2929
This article describes how to enable [data compression](data-compression.md) on an existing table or index in [!INCLUDE [ssnoversion](../../includes/ssnoversion-md.md)] by using [!INCLUDE [ssManStudioFull](../../includes/ssmanstudiofull-md.md)] or [!INCLUDE [tsql](../../includes/tsql-md.md)]. To enable data compression when creating a table or index, see the [Create a compressed index](../../t-sql/statements/create-index-transact-sql.md#l-create-a-compressed-index) and [Creating a table that uses row compression](../../t-sql/statements/create-table-transact-sql.md#n-creating-a-table-that-uses-row-compression) examples.
3030

31-
## Limitations and restrictions
31+
## Limitations
3232

3333
- System tables can't be enabled for compression.
3434

@@ -92,13 +92,16 @@ Requires `ALTER` permission on the table or index.
9292

9393
If you select **Create script**, the following options are available under **Script options**:
9494

95-
- **Script to file**
95+
- **Script to file**
96+
9697
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**.
9798

98-
- **Script to Clipboard**
99+
- **Script to Clipboard**
100+
99101
Saves the script to the Clipboard.
100102

101-
- **Script to New Query Window**
103+
- **Script to New Query Window**
104+
102105
Generates the script to a new Query Editor window. This is the default selection.
103106

104107
- If you select **Schedule**, select **Change schedule**.
@@ -195,21 +198,21 @@ Requires `ALTER` permission on the table or index.
195198

196199
## <a id="TsqlProcedure"></a> Use Transact-SQL
197200

198-
### SQL Server and Azure SQL Database
201+
In your database of choice, run [sp_estimate_data_compression_savings (Transact-SQL)](../system-stored-procedures/sp-estimate-data-compression-savings-transact-sql.md) and then enable compression on the table or index. See the following sections.
199202

200-
In [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] or [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], run `sp_estimate_data_compression_savings` and then enable compression on the table or index. See the following sections.
203+
[!INCLUDE [article-uses-adventureworks](../../includes/article-uses-adventureworks.md)]
201204

202205
#### Enable compression on a table
203206

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

206209
1. On the Standard bar, select **New Query**.
207210

211+
1. Make sure you are in the context of your database.
212+
208213
1. 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.
209214

210215
```sql
211-
USE AdventureWorks2022;
212-
GO
213216
EXEC sp_estimate_data_compression_savings 'Production', 'TransactionHistory', NULL, NULL, 'ROW';
214217

215218
ALTER TABLE Production.TransactionHistory REBUILD PARTITION = ALL
@@ -223,11 +226,11 @@ In [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] or [!INCLUDE [ssaz
223226

224227
1. On the Standard bar, select **New Query**.
225228

229+
1. Make sure you are in the context of your database.
230+
226231
1. 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.
227232

228233
```sql
229-
USE AdventureWorks2022;
230-
GO
231234
SELECT name, index_id
232235
FROM sys.indexes
233236
WHERE OBJECT_NAME (object_id) = N'TransactionHistory';
@@ -243,13 +246,13 @@ In [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] or [!INCLUDE [ssaz
243246
GO
244247
```
245248

246-
For more information, see [ALTER TABLE (Transact-SQL)](../../t-sql/statements/alter-table-transact-sql.md) and [ALTER INDEX (Transact-SQL)](../../t-sql/statements/alter-index-transact-sql.md).
249+
For more information, see [ALTER TABLE](../../t-sql/statements/alter-table-transact-sql.md) and [ALTER INDEX](../../t-sql/statements/alter-index-transact-sql.md).
247250

248-
## See also
251+
## Related content
249252

250253
- [Data compression](data-compression.md)
251254
- [Row compression implementation](row-compression-implementation.md)
252255
- [Page compression implementation](page-compression-implementation.md)
253-
- [sp_estimate_data_compression_savings (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-estimate-data-compression-savings-transact-sql.md)
256+
- [sp_estimate_data_compression_savings (Transact-SQL)](../system-stored-procedures/sp-estimate-data-compression-savings-transact-sql.md)
254257
- [Create a compressed index](../../t-sql/statements/create-index-transact-sql.md#l-create-a-compressed-index)
255258
- [Create a table that uses row compression](../../t-sql/statements/create-table-transact-sql.md#n-creating-a-table-that-uses-row-compression)

0 commit comments

Comments
 (0)