Microsoft Certified Azure Data Engineer Associate · Free Practice Question Medium
Question 16
Scenario: Honest Eddie's Car Dealership is an establishment in South Carolina USA, which is dedicated to the purchase and sale of cars and light trucks. Eddie is concerned if the data his IT team is working with is unevenly allocated across all distributions.
Which of the following would be the best approach to investigate if the data at hand is unevenly allocated across all distributions?
-
A
Grouping the data based on partitions and counting rows with a T-SQL query.
-
B
Use Power BI to create a visualization to determine the distribution pattern.
-
C
Using
DBCC PDW_SHOWSPACEUSEDto see the number of table rows that are stored in each of the 60 distributions. -
D
Monitor query speeds by testing the same query for each partition.
Reveal correct answer
Correct answer: C
Explanation
DBCC PDW_SHOWSPACEUSED returns the number of table rows that are stored in each of the 60 distributions.
In simple terms, data skew is an over-represented value. Imagine that you have assigned 50 tax examiners to audit tax returns, one examiner for each US state. The Wyoming examiner, because the population there is small, has little to do. In California, however, the examiner is kept very busy because of the state's large population.

The data is unevenly distributed across all tax examiners, which means that some examiners must work more than others. In your job, you frequently experience situations like the tax-examiner example here. In more technical terms, one vertex gets much more data than its peers, a condition that makes the vertex work more than the others and that eventually slows down an entire job. What's worse, the job might fail because vertices might have, for example, a 5-hour runtime limitation and a 6-GB memory limitation.
A quick way to check for data skew is to use DBCC PDW_SHOWSPACEUSED. The following SQL code returns the number of table rows that are stored in each of the 60 distributions. For balanced performance, the rows in your distributed table should be spread evenly across all the distributions.
- SQL
- -- Find data skew for a distributed table
- DBCC PDW_SHOWSPACEUSED('dbo.FactInternetSales');
Another aspect of data storage in Azure Synapse dedicated SQL pools is to monitor the table data space usage and observe its relationship with different table distribution types. Additionally, it is helpful to know the number of rows and the storage space used for indexing. Below is a list of System Dynamic Management Views (DMVs) that you can use to dig for the information. During the next exercise you will create a view using these DMVs to get a better view of the data.

Since a columnstore index scans a table by scanning column segments of individual rowgroups, maximizing the number of rows in each rowgroup enhances query performance. When rowgroups have a high number of rows, data compression improves which means there is less data to read from disk. The number of rows in a rowgroup determines the rowgroup's quality.
For best query performance, the goal is to maximize the number of rows per rowgroup in a columnstore index. A rowgroup can have a maximum of 1,048,576 rows. It's okay to not have the maximum number of rows per rowgroup. Columnstore indexes achieve good performance when rowgroups have at least 100,000 rows.
During a bulk load or columnstore index rebuild, sometimes there isn't enough memory available to compress all the rows designated for each rowgroup. When memory pressure is present, columnstore indexes trim the rowgroup sizes so compression into the columnstore can succeed.
The DMV sys.dm_pdw_nodes_db_column_store_row_group_physical_stats exposes useful information such as number of rows in rowgroups and the reason for trimming, if there was trimming.
There are two columns from dm_pdw_nodes_db_column_store_row_group_physical_stats worth looking into in detail. The state_desc column provides useful information on the state of a row group:

Additionally, the trim_reason_desc column describes the reason that triggered the COMPRESSED rowgroup to have less than the maximum number of rows:

A. Grouping the data based on partitions and counting rows with a T-SQL query can help in understanding the distribution of data within each partition. However, this approach may not provide a comprehensive view of the overall distribution across all distributions in the data warehouse.
B. Using Power BI to create a visualization to determine the distribution pattern may provide a high-level overview of the data distribution across different partitions. However, this method may not offer detailed insights into the exact number of rows stored in each distribution, which is crucial for investigating uneven data allocation.
C. Using DBCC PDW_SHOWSPACEUSED allows the data engineer to see the number of table rows stored in each of the 60 distributions in the data warehouse. This information will provide insights into whether the data is evenly distributed across all distributions or if there are any imbalances that need to be addressed.
D. Monitoring query speeds by testing the same query for each partition can help in identifying performance differences across partitions. While this approach may highlight potential issues with data distribution, it may not directly address the specific concern of uneven data allocation across all distributions.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
