SQL Server Questions and Answers – Data Compression

This set of SQL Server Multiple Choice Questions & Answers (MCQs) focuses on “Data Compression”.

1. Which of the following compression type is supported by SQL Server 2014?
a) Row
b) Column
c) Both row and column
d) None of the mentioned
View Answer

Answer: c
Explanation: SQL Server 2014 supports columnstore and columnstore archival compression for columnstore tables and indexes.

2. Point out the correct statement.
a) The details of data compression are subject to change without notice in service packs or subsequent releases
b) Compression is not available for system tables
c) If you specify a list of partitions or a partition that is out of range, an error will be generated
d) All of the mentioned
View Answer

Answer: d
Explanation: These are considerations made before using row and page compression.

3. Use _________ data compression to compress columnstore data with archival compression.
a) COLUMNSTOREARCHIVE
b) COLUMNSTORE_ARCHIVE
c) COLUMNSTORE
d) All of the mentioned
View Answer

Answer: b
Explanation: To perform archival compression, SQL Server runs the Microsoft XPRESS compression algorithm on the data.

4. To remove archival compression and restore the data to columnstore compression _____________
a) Use ALTER TABLE
b) Use ALTER COLUMN
c) Use ALTER DATABASE
d) All of the mentioned
View Answer

Answer: a
Explanation: use ALTER TABLE (Transact-SQL) or ALTER INDEX (Transact-SQL) with the REBUILD option and DATA COMPRESSION = COLUMNSTORE.

advertisement
advertisement

5. Point out the wrong statement.
a) You can enable or disable ROW or PAGE compression in online state only
b) When you are compressing indexes, leaf-level pages can be compressed with both row and page compression
c) Non–leaf-level pages do not receive page compression
d) None of the mentioned
View Answer

Answer: a
Explanation: Enabling compression on a heap is single threaded for an online operation.

6. The data_compression and data_compression_desc columns include ___________
a) COLUMNSTOREARCHIVE
b) COLUMNSTORE_ARCH
c) COLUMNSTORE
d) None of the mentioned
View Answer

Answer: c
Explanation: The type and type_desc columns include CLUSTERED COLUMNSTORE and NONCLUSTERED COLUMNSTORE.

7. Which of the following code is used to enable compression on a table?
a)

EXEC sp_estimate_compression_savings 'Production', 'TransactionHistory', NULL, NULL, 'ROW' ;
 
ALTER TABLE Production.TransactionHistory REBUILD PARTITION = ALL
WITH (DATA_COMPRESSION = ROW);

b)

advertisement
EXEC sp_estimate_compression_savings 'Production', 'TransactionHistory', NULL, NULL, 'ROW' ;
 
ALTER TABLE Production.TransactionHistory REBUILD PARTITION = ALL
WITH (DATA_COMPRESSION = ROW);

c)

advertisement
EXEC sp_estimate_compression_savings 'Production', 'TransactionHistory', NULL, NULL, 'ROW' ;
 
ALTER TABLE Production.TransactionHistory BUILD PARTITION = ALL
WITH (DATA_COMPRESSION = ROW);

d)

EXEC sp_estimate_compression 'Production', 'TransactionHistory', NULL, NULL, 'ROW' ;
 
ALTER TABLE Production.TransactionHistory REBUILD PARTITION = ALL
WITH (DATA_COMPRESSION = ROW);
View Answer
Answer: a
Explanation: The following query 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.

8. What is the purpose of schema name in the following code 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' 
[;]

a) Name of the table
b) Name of the database schema
c) Name of the indexed view
d) All of the mentioned
View Answer

Answer: b
Explanation: If schema_name is NULL, the default schema of the current user is used.

9. sp_estimate_data_compression_savings requires ______ permission on the table.
a) UPDATE
b) SELECT
c) DELETE
d) None of the mentioned
View Answer

Answer: b
Explanation: Use sp_estimate_data_compression_savings to estimate the savings that can occur when you enable a table or partition for row or page compression.

10. Which of the following query estimates the size of the Production.WorkOrderRouting table if it is compressed by using ROW compression?
a) EXEC sp_estimate_data_compression_savings ‘Production’, ‘WorkOrderRouting’, NULL, NULL, ‘ROW’ ;
b) EXEC sp_estimate_data_compression_savings ‘Production’, ‘WorkOrderRouting’, NULL, 1, ‘ROW’ ;
c) EXEC sp_estimate_data_compression_savings ‘Production’, ‘WorkOrderRouting’, 1, NULL, ‘ROW’ ;
d) EXEC sp_estimate_data_compression_savings ‘Production’, ‘WorkOrderRouting’, NULL, NULL, ‘COLUMN’ ;
View Answer

Answer: a
Explanation: To estimate the size of the object if it were to use the requested compression setting, this stored procedure samples the source object and loads this data into an equivalent table and index created in tempdb.

Sanfoundry Global Education & Learning Series – SQL Server.

To practice all areas of SQL Server, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.