Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Introducing Microsoft SQL Server 2019

You're reading from   Introducing Microsoft SQL Server 2019 Reliability, scalability, and security both on premises and in the cloud

Arrow left icon
Product type Paperback
Published in Apr 2020
Publisher Packt
ISBN-13 9781838826215
Length 488 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (8):
Arrow left icon
Allan Hirt Allan Hirt
Author Profile Icon Allan Hirt
Allan Hirt
Dustin Ryan Dustin Ryan
Author Profile Icon Dustin Ryan
Dustin Ryan
Mitchell Pearson Mitchell Pearson
Author Profile Icon Mitchell Pearson
Mitchell Pearson
Kellyn Gorman Kellyn Gorman
Author Profile Icon Kellyn Gorman
Kellyn Gorman
Dave Noderer Dave Noderer
Author Profile Icon Dave Noderer
Dave Noderer
Buck Woody Buck Woody
Author Profile Icon Buck Woody
Buck Woody
Arun Sirpal Arun Sirpal
Author Profile Icon Arun Sirpal
Arun Sirpal
James Rowland-Jones James Rowland-Jones
Author Profile Icon James Rowland-Jones
James Rowland-Jones
+4 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Optimizing for performance, scalability and real‑time insights 2. Enterprise Security FREE CHAPTER 3. High Availability and Disaster Recovery 4. Hybrid Features – SQL Server and Microsoft Azure 5. SQL Server 2019 on Linux 6. SQL Server 2019 in Containers and Kubernetes 7. Data Virtualization 8. Machine Learning Services Extensibility Framework 9. SQL Server 2019 Big Data Clusters 10. Enhancing the Developer Experience 11. Data Warehousing 12. Analysis Services 13. Power BI Report Server 14. Modernization to the Azure Cloud

Estimate compression for Columnstore Indexes

The stored procedure sp_estimate_data_compression_savings estimates the object size for the requested compression state. Furthermore, you can evaluate potential compression savings for whole tables or parts of tables; we will discuss the available options shortly. Prior to SQL Server 2019, you were unable to use sp_estimate_data_compression_savings for columnstore indexes and, thus, we were unable to estimate compression for columnstore or columnstore_archive.

We have extended the capability for sp_estimate_data_compression_savings to include support for COLUMNSTORE and COLUMNSTORE_ARCHIVE.

sp_estimate_data_compression_savings Syntax

Look at the following T-SQL syntax:

sp_estimate_data_compression_savings   
     [ @schema_name = ] 'schema_name'    
   , [ @object_name = ] 'object_name'   
   , [@index_id = ] index_id   
   , [@partition_number = ] partition_number   
   , [@data_compression = ] 'data_compression'   
[;]

The following argument descriptions are provided by docs.microsoft.com: https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-estimate-data-compression-savings-transact-sql?view=sql-server-2017.

Table 1.27: Description of the arguments
Table 1.26: Description of the arguments

There are currently eight available outputs; you will primarily focus on the four outputs related to size.

Output:

object_name
schema_name
index_id
partition_number
size_with_current_compression_setting (KB)
size_with_requested_compression_setting (KB)
sample_size_with_current_compression_setting (KB)
sample_size_with_current_requested_setting (KB)

The following is an example of the procedure in action, followed by a comparison of the space savings for page and columnstore compression:

EXEC sp_estimate_data_compression_savings 
    @schema_name = 'dbo', 
    @object_name = 'MySourceTable', 
    @index_id = NULL, 
    @partition_number = NULL, 
    @data_compression = 'PAGE'

Example with PAGE Compression:

Figure 1.28: PAGE Compression
Figure 1.27: PAGE Compression
EXEC sp_estimate_data_compression_savings 
    @schema_name = 'dbo', 
    @object_name = 'MySourceTable', 
    @index_id = NULL, 
    @partition_number = NULL, 
    @data_compression = 'COLUMNSTORE'

Example with COLUMNSTORE compression:

Figure 1.29: COLUMNSTORE compression
Figure 1.28: COLUMNSTORE compression

In this example, page compression has estimated space savings of roughly 45%, and columnstore compression has estimated space savings of 68%.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image