Courseiva

CCNA Performance Optimization, Querying, and Transformation Questions

65 questions · Performance Optimization, Querying, and Transformation · All types, answers revealed

1
MCQhard

A data engineer observes that a transformation query run on a MEDIUM warehouse spends most of its time in the 'Remote Disk Spilling' phase of the Query Profile. The query joins two large tables and performs a large sort. Memory usage shows the warehouse consistently near its limit. The engineer wants the most direct fix that addresses the root cause. Which action should be taken?

A.Enable the query acceleration service on the warehouse to offload the sort to shared compute.
B.Rewrite the query to use a smaller data type for the join keys so less memory is consumed per row.
C.Increase the size of the virtual warehouse so more memory is available per node and spilling is avoided.
D.Add a clustering key to the larger table so fewer micro-partitions are scanned during the join.
AnswerC

Remote disk spilling means the operation exceeded the memory available on its warehouse and had to write intermediate data to remote storage, which is far slower. Scaling up the warehouse adds memory capacity to handle the join and sort working set. This directly addresses the memory shortfall that the Query Profile is showing.

Why this answer

Remote disk spilling indicates that the join and sort working set exceeded warehouse memory and intermediate data was written to remote storage. The most direct remedy is to give the operation more memory by scaling up the virtual warehouse, which increases the memory available per node. Query rewriting, query acceleration, and clustering all fail to address the memory shortfall that the Query Profile is reporting.

Exam trap

The trap here is treating remote spilling as a scan-efficiency problem and reaching for clustering or query acceleration, when the spill happens in memory-intensive join and sort operators.

2
Multi-Selecthard

Which THREE factors influence the performance of a Snowflake query? (Choose three)

Select 3 answers
A.The amount of data in the result cache.
B.The clustering of data in micro-partitions.
C.The virtual warehouse size.
D.The number of users currently logged into the system.
E.The complexity and design of the SQL statement.
AnswersB, C, E

Effective clustering ensures that similar data is stored together in the same micro-partitions. This allows the query optimizer to perform partition pruning, effectively skipping large chunks of data that do not match the query filters, which is a primary driver of query performance in large-scale datasets.

Why this answer

Performance in Snowflake is multidimensional, influenced by both user-driven configurations and the automated optimization processes inherent in the architecture. Key factors include the degree of data clustering, which dictates how much data must be scanned; the warehouse size, which provides the raw compute power for processing; and the efficiency of the SQL code, such as avoiding unnecessary operations. Understanding these allows administrators to balance cost and performance effectively in their Snowflake environment.

Exam trap

Candidates often include 'number of users' as a performance factor. While user count impacts concurrency, it does not directly influence the execution time of a single query's logic.

3
MCQhard

A data engineer is optimizing a query that filters on a high-cardinality column in a very large table. The query currently performs a full table scan. The engineer decides to add a clustering key on that column. After clustering, the query performance improves significantly for some queries but remains poor for others that filter on a different low-cardinality column. What is the most likely reason for the inconsistent performance?

A.Clustering keys only improve performance for queries that filter on the clustering key column; other filters benefit only if they are correlated with the clustering key.
B.The clustering key must be defined on all columns used in WHERE clauses to achieve any performance improvement.
C.The automatic clustering service has not yet reclustered the table, so the clustering key is not effective for any query.
D.Clustering keys only benefit queries that use the CLUSTER BY clause in the SELECT statement.
AnswerA

Clustering organizes data by the clustering key, so queries filtering on that column can skip many micro-partitions. Queries filtering on a different, uncorrelated column cannot benefit because the data is not sorted by that column. The low-cardinality column likely does not correlate with the high-cardinality clustering key, so pruning is ineffective. This explains why some queries improved while others did not.

Why this answer

Clustering improves pruning only for predicates on the clustering key or on columns that are correlated with it. When queries filter on a different, uncorrelated column, the micro-partitions cannot be pruned based on that column, so performance remains poor. The engineer should consider whether the low-cardinality column is correlated with the clustering key or consider a different clustering strategy, such as clustering on an expression that combines both columns if that aligns with query patterns.

Exam trap

The trap here is assuming that clustering on one column will speed up all queries regardless of their filter columns, when pruning only works for the clustering key or correlated columns.

4
MCQhard

A data engineer notices a large table's clustering depth is very high on the columns used in frequent range filters, and queries are scanning far more micro-partitions than expected. The table receives continuous small inserts throughout the day. Which action best improves pruning while controlling reclustering cost?

A.Remove the clustering key and add a search optimization service on the filter columns instead.
B.Keep the existing clustering key and rely on automatic reclustering to restore ordering.
C.Batch the small inserts into larger, less frequent loads so fewer micro-partitions are created out of order.
D.Change the clustering key to a high-cardinality column such as a unique transaction ID.
AnswerC

Continuous tiny inserts create many small, overlapping micro-partitions that raise clustering depth and force reclustering. Consolidating them into larger, less frequent loads produces better-ordered micro-partitions with less overlap, improving pruning while reducing the volume of data automatic reclustering must reorganize. This directly addresses both the pruning problem and the reclustering cost in the scenario.

Why this answer

Frequent tiny inserts scatter data across many micro-partitions, inflating clustering depth and undermining min-max pruning. Consolidating those inserts into larger batches yields better-ordered micro-partitions, so range filters prune more effectively and automatic reclustering has less fragmented data to reorganize. Choosing a different key or removing clustering would not solve the root cause of the poor ordering.

Exam trap

The trap here is blaming the clustering key itself rather than the insert pattern, when continuous small loads are what degrade micro-partition ordering.

5
MCQmedium

When querying an External Table, which technique provides the most significant performance improvement for selective queries?

A.Converting the files in cloud storage to the CSV format.
B.Defining logical partitions that correspond to the storage path.
C.Enabling the Search Optimization Service on the external table.
D.Increasing the warehouse size to 6X-Large.
AnswerB

Partitioning external tables allows Snowflake to use 'partition pruning' at the cloud storage level. By only accessing the specific folders or files that match the query's filter criteria, the system avoids downloading unnecessary data, which is the most common bottleneck for external table performance.

Why this answer

External tables reside on cloud storage outside of Snowflake. To avoid scanning all files in a bucket, Snowflake uses partitioning. By defining partition columns that match the folder structure of the external storage (e.g., year/month/day), the engine can prune irrelevant files, significantly reducing the I/O required for the query.

Exam trap

Candidates often think that indexing the external data files is the primary solution. They overlook that partition pruning via directory structure is the actual mechanism for performance.

6
MCQeasy

A company is using a Multi-cluster Warehouse with the 'Auto-scale' mode enabled. What is the primary performance benefit of this configuration for a BI dashboard used by 500 concurrent users?

A.It reduces the execution time of a single, complex long-running query.
B.It increases the memory available for large-scale data joins.
C.It prevents query queuing by providing more clusters to handle concurrent requests.
D.It automatically optimizes the clustering keys of the tables being queried.
AnswerC

The primary goal of multi-cluster warehouses is to manage high concurrency. When the number of incoming queries exceeds the capacity of a single cluster, Snowflake automatically spins up additional clusters to process the extra load, ensuring that users do not experience delays due to queuing.

Why this answer

Multi-cluster warehouses are designed to handle high concurrency by automatically starting additional warehouse clusters as query queuing is detected. This ensures that as more users connect and run queries, the system can scale horizontally to maintain consistent performance and minimize wait times for all users.

Exam trap

Candidates often believe multi-cluster warehouses increase the speed of individual queries. They fail to realize it only scales horizontally to handle more concurrent users, not faster single-query execution.

7
MCQeasy

How does Snowflake's micro-partitioning architecture contribute to query performance without requiring user intervention?

A.It requires users to manually define partition boundaries for every table.
B.It uses metadata to prune irrelevant micro-partitions during query execution.
C.It compresses data using a single global algorithm for the entire table.
D.It stores all data in a single massive file to avoid file system overhead.
AnswerB

Snowflake stores metadata (min/max values, etc.) for every column in every micro-partition. When a query is run, the engine uses this metadata to determine which partitions cannot possibly contain the requested data, allowing it to skip those partitions and only scan the necessary data.

Why this answer

Micro-partitioning is the foundation of Snowflake's performance and scalability. Because it is automatic, users do not need to define partitions manually as they do in traditional systems. This 'zero-management' approach ensures that data is always organized for performance, and the metadata generated during this process is what enables extremely fast pruning.

Exam trap

Many candidates believe users must manually specify partition keys or run maintenance jobs, forgetting that Snowflake handles micro-partitioning completely automatically.

8
Multi-Selectmedium

A data engineer is investigating a slow-running query. The Query Profile shows a high percentage of time spent in the TableScan operator and a large number of partitions scanned. The engineer wants to reduce the number of partitions scanned by using pruning. Which TWO actions should the engineer take? (Choose two.)

Select 2 answers
A.Apply filters early in the query and avoid wrapping filter columns in functions.
B.Increase the size of the virtual warehouse to reduce the number of partitions scanned.
C.Use the SEARCH function in the WHERE clause for all string filters.
D.Convert the table to a transient table to enable automatic pruning.
E.Ensure that the query filters on columns that are part of the clustering key, if one exists.
AnswersA, E

Filters that are applied directly to columns allow the optimizer to use them for partition pruning. Wrapping a filter column in a function, such as UPPER or CAST, can prevent the optimizer from using the column's metadata for pruning. Applying filters early and keeping them as simple predicates on columns helps Snowflake eliminate unnecessary micro-partitions, reducing the number of partitions scanned.

Why this answer

Partition pruning is driven by filters that the optimizer can use against micro-partition metadata. Filtering on clustering key columns and avoiding functions on filter columns allow Snowflake to skip irrelevant micro-partitions, directly reducing the number of partitions scanned.

Exam trap

The trap here is thinking that warehouse size or table type affects the number of partitions scanned, when pruning is determined by the query predicates and data organization.

9
Multi-Selecthard

A data engineer is optimizing a complex query that joins multiple large tables and includes several aggregations. The Query Profile shows a high number of rows spilled to local disk and remote disk. Which TWO actions are most likely to reduce spilling and improve performance? (Choose two.)

Select 2 answers
A.Add a clustering key on the join columns of the largest table.
B.Convert the query to use a temporary table to materialize intermediate results.
C.Rewrite the query to filter and aggregate data earlier in the pipeline.
D.Enable the USE_CACHED_RESULT parameter to reuse previous results.
E.Increase the size of the virtual warehouse to provide more memory.
AnswersC, E

By applying filters and aggregations as early as possible, the volume of data that needs to be joined and processed is reduced. This lowers the memory footprint of intermediate results, decreasing the likelihood of spilling. Early aggregation can also reduce the size of hash tables used in joins, further alleviating memory pressure.

Why this answer

Spilling indicates that intermediate results exceed available memory. Increasing warehouse size provides more memory, and rewriting the query to filter and aggregate earlier reduces the volume of intermediate data. Clustering, result caching, and temporary tables do not directly address the memory pressure causing the spilling.

Exam trap

The trap here is assuming that clustering or caching will fix spilling, when spilling is a memory issue best solved by more memory or less data.

10
MCQhard

A Materialized View is created on a base table that experiences high churn (frequent inserts, updates, and deletes). What is the most likely impact of this configuration?

A.The Materialized View will become stale and return outdated results.
B.Virtual warehouse credits will be used for the background maintenance.
C.The cost of maintaining the view may exceed the query performance benefits.
D.The base table will be locked during the view's maintenance cycles.
AnswerC

Because high churn triggers frequent serverless background updates, the cumulative cost of these updates can be very high. If the query performance improvement is marginal or the view is not queried frequently, the total cost of ownership becomes inefficient compared to querying the base table directly.

Why this answer

Materialized views in Snowflake are maintained by a serverless background process. When the base table changes, the view must be updated to remain consistent. High churn on the base table leads to frequent maintenance tasks, which can result in significant serverless credit consumption, often making the view more expensive than the performance benefit it provides.

Exam trap

Test-takers frequently assume materialized views are always beneficial for performance, overlooking the heavy background serverless maintenance costs incurred when base tables have high churn.

11
Multi-Selectmedium

A data engineer needs to transform a variant column containing an array of objects into a relational format. Which TWO Snowflake features or functions are required to achieve this?

Select 2 answers
A.The FLATTEN function
B.The UNPIVOT clause
C.The LATERAL keyword
D.The PARSE_JSON function
E.The STRTOK_TO_ARRAY function
AnswersA, C

The FLATTEN table function is specifically designed to convert semi-structured data into a relational representation. It takes a VARIANT, OBJECT, or ARRAY and explodes it into multiple rows, providing columns for the index, key, and value of the nested elements, which is essential for flattening arrays.

Why this answer

To transform semi-structured data like arrays into individual rows, the FLATTEN function is used to explode the array elements. This is typically paired with the LATERAL keyword, which allows the FLATTEN function to reference columns from preceding tables in the FROM clause, effectively joining each array element back to its parent row.

Exam trap

Candidates often forget the LATERAL keyword. Without it, the FLATTEN function cannot correlate the exploded rows with the original columns from the source table.

12
MCQmedium

A query is experiencing performance degradation, and the Query Profile indicates 'Remote Disk Spilling'. Which action is the most direct solution to resolve this specific bottleneck?

A.Enable the Search Optimization Service on the table.
B.Scale up the virtual warehouse to a larger size.
C.Implement a clustering key on the table's join columns.
D.Create a Materialized View for the underlying query.
AnswerB

Scaling up doubles the local memory and SSD storage at each increment, allowing the warehouse to handle larger intermediate datasets locally. This prevents the system from needing to spill data to remote storage, which is the primary cause of the performance degradation observed when local resources are insufficient.

Why this answer

Remote disk spilling occurs when the local SSD storage of a virtual warehouse is completely exhausted, forcing Snowflake to write intermediate data to slower remote cloud storage. This usually happens during large sorts, joins, or aggregations. Increasing the warehouse size provides more memory and local storage, ensuring that large intermediate result sets can be processed without hitting the high-latency remote storage layer.

Exam trap

Candidates often select 'scale out' (multi-cluster warehouses) to fix spilling, not realizing that concurrency scaling does not provide more memory to a single heavy query.

13
MCQhard

A data engineer runs a query that performs a large aggregation over a table with billions of rows. The Query Profile shows that the Aggregate operator is spilling to local disk. The engineer wants to eliminate the spilling and improve performance. Which action is most likely to achieve this?

A.Enable the USE_CACHED_RESULT parameter to reuse previous aggregation results.
B.Add a cluster key on the group-by columns to reduce the number of groups.
C.Rewrite the query to use a window function instead of a GROUP BY aggregation.
D.Increase the warehouse size to provide more memory for the aggregation.
AnswerD

Spilling to local disk occurs when the aggregation's working set exceeds the memory available on the warehouse nodes. Increasing the warehouse size adds more memory per node, which can allow the aggregation to be performed entirely in memory. This directly addresses the root cause of spilling and can eliminate the performance penalty associated with disk I/O.

Why this answer

Spilling to local disk indicates that the aggregation operator's memory footprint exceeds the available memory on the warehouse. Increasing the warehouse size provides more memory per node, allowing the aggregation to complete in memory. This is the most direct solution because it addresses the resource constraint.

Clustering, query rewriting, and result caching do not increase memory and therefore do not resolve the spilling condition.

Exam trap

The trap here is thinking that clustering or query rewriting can reduce memory usage for an aggregation, when only additional memory or reduced data volume can prevent spilling.

14
MCQeasy

A data engineer needs to transform semi-structured JSON data stored in a VARIANT column into a relational table with separate columns for each attribute. The JSON contains nested objects and arrays. Which Snowflake feature should the engineer use to flatten the arrays and extract the nested attributes in a single SQL statement?

A.Create a materialized view over the VARIANT column and query it with standard SQL.
B.Use the TRY_CAST function to convert the VARIANT to a string and then use string functions to parse the JSON.
C.LATERAL FLATTEN with the INPUT => column and PATH => 'nested_array' arguments, combined with the VALUE and THIS keywords.
D.Use the PARSE_JSON function to convert the VARIANT into a relational table automatically.
AnswerC

LATERAL FLATTEN is specifically designed to explode arrays and nested objects within a VARIANT column into multiple rows. Using INPUT to specify the VARIANT column, PATH to target the nested array, and VALUE or THIS to reference the exploded elements allows the engineer to join the flattened output back to the original row and extract attributes with the colon operator. This is the standard Snowflake approach for relationalizing semi-structured data.

Why this answer

LATERAL FLATTEN is the primary Snowflake construct for expanding arrays within a VARIANT column. It produces one row per element in the array, and by using the VALUE or THIS keyword, the engineer can access the element's attributes. Combining this with a SELECT that references the original table's columns and the flattened output allows a single SQL statement to transform nested JSON into a relational result set.

Exam trap

The trap here is confusing PARSE_JSON, which only converts strings to VARIANT, with FLATTEN, which actually explodes arrays into rows.

15
MCQhard

A data engineer runs a query that joins a large fact table with a small dimension table. The Query Profile shows a Join operation with an exploding number of rows and significant spilling to remote disk. The engineer notices the join condition uses a function on the join key of the large table. Which action is most likely to improve performance?

A.Add a clustering key on the join column of the large table.
B.Rewrite the join to avoid applying a function to the join key of the large table.
C.Increase the size of the virtual warehouse to a larger multi-cluster warehouse.
D.Enable the USE_CACHED_RESULT parameter for the session.
AnswerB

Applying a function to the join key of the large table prevents the optimizer from using an efficient join method and may cause a Cartesian-like explosion. By rewriting the join to compare the raw column values directly, the optimizer can choose a hash join and leverage micro-partition pruning. This directly addresses the root cause of the row explosion and spilling.

Why this answer

The function on the join key prevents the optimizer from using an efficient join strategy and can cause a row explosion. Rewriting the join to compare raw columns allows hash join and pruning, directly fixing the root cause. Larger warehouses, clustering on the raw column, or caching do not address the expression in the join predicate.

Exam trap

The trap here is assuming that scaling up the warehouse or adding clustering will solve join performance issues, when the real problem is the function applied to the join key.

16
MCQeasy

A data analyst runs a query that joins a large fact table with a small dimension table. The query is slow, and the Query Profile shows a lot of data movement across the warehouse. Which Snowflake feature is designed to improve performance by automatically broadcasting small tables to all nodes in the warehouse?

A.Result Caching
B.Search Optimization Service
C.Automatic Clustering
D.Broadcast Join
AnswerD

Snowflake's optimizer can choose a broadcast join when one table is small enough, sending a copy of that table to all nodes that hold the larger table's data. This avoids shuffling the large table and reduces data movement. The Query Profile would show a Broadcast operation. This is a built-in optimization that automatically applies based on statistics and table size.

Why this answer

The optimizer may choose a broadcast join when one side of the join is small, sending that table to all nodes to avoid shuffling the large table. This reduces data movement and speeds up the join. The Query Profile would indicate a Broadcast operation.

Other features like Result Caching, Automatic Clustering, and Search Optimization Service address different performance aspects and do not directly control join data movement.

Exam trap

The trap here is confusing features that improve overall query performance with the specific join optimization that handles small tables by broadcasting them.

17
MCQhard

A data engineer is analyzing a slow query that uses a window function with a PARTITION BY clause on a high-cardinality column. The Query Profile shows that the window function is causing significant data shuffling. The engineer wants to reduce the shuffling. Which approach is most likely to improve performance?

A.Add an ORDER BY clause inside the window function to sort the data before partitioning.
B.Replace the window function with a self-join on the partitioning column.
C.Use a QUALIFY clause to filter the results after the window function is computed.
D.Pre-aggregate the data in a subquery or CTE to reduce the number of rows before applying the window function.
AnswerD

Pre-aggregating the data reduces the volume of rows that need to be shuffled for the window function. If the window function operates on a smaller dataset, the shuffling overhead decreases. This is a common optimization: compute aggregations first, then apply window functions on the aggregated result. It can significantly improve performance when the original dataset is large and the window function does not require row-level detail.

Why this answer

The shuffling is caused by the need to co-locate rows with the same partition key. If the dataset is reduced before the window function, the shuffle volume decreases. Pre-aggregating in a subquery or CTE is an effective way to reduce the number of rows that must be redistributed.

This is especially beneficial when the window function does not need row-level detail. The other options either do not affect shuffling or introduce additional overhead.

Exam trap

The trap here is thinking that adding an ORDER BY or using QUALIFY will reduce shuffling, when in fact only reducing the data volume before the window function can mitigate the shuffle.

18
MCQhard

Which approach is most effective for optimizing an aggregation query that performs a 'GROUP BY' on a high-cardinality column?

A.Increase the warehouse size to add more nodes.
B.Use a materialized view to pre-aggregate the data.
C.Reduce the number of columns in the SELECT clause.
D.Change the table type to transient.
AnswerB

Materialized views automatically maintain pre-aggregated data. When the query is run, Snowflake can often leverage these pre-computed results instead of performing the expensive 'GROUP BY' on the raw, high-cardinality column at runtime. This drastically reduces CPU and memory usage, leading to much faster performance for the analytical query.

Why this answer

High-cardinality columns can cause memory bottlenecks during aggregation because the distinct values cannot fit into the memory of a single node, leading to disk spilling. By using techniques like pre-aggregation or creating a materialized view that groups the data by the high-cardinality column, you reduce the workload. These strategies move the compute-heavy grouping operation to a more efficient time or structure, thereby preventing memory exhaustion and significantly improving the performance of the aggregation query.

Exam trap

Candidates often suggest increasing warehouse size as a first step, ignoring that materialized views specifically address high-cardinality aggregation bottlenecks more efficiently than scaling compute resources alone.

19
MCQhard

Refer to the exhibit. Based on the Query Profile snippet, which optimization strategy would most likely address the high execution time and massive row production?

A.Apply a clustering key to the primary keys of both tables.
B.Enable the Query Acceleration Service for the warehouse.
C.Review the SQL to ensure a valid join predicate exists between the tables.
D.Increase the warehouse size to 4X-Large to handle the volume.
AnswerC

A Cartesian product indicates that the SQL lacks a restrictive join condition, causing an explosion in the result set size. By defining a proper predicate, the optimizer can use more efficient join algorithms like Hash Joins, drastically reducing the number of rows processed and the total execution time.

Why this answer

The exhibit identifies a Cartesian product join, which occurs when a join condition is missing or improperly defined, resulting in every row from one table being combined with every row from another. This leads to exponential data growth and severe performance issues. Correcting the join logic is the only way to prevent the system from generating these massive, unnecessary intermediate datasets.

Exam trap

Candidates often try to resolve massive row explosions by scaling up the virtual warehouse or adding clustering keys, ignoring the root structural issue which is an accidental Cartesian product.

20
MCQmedium

Which function or command should be used to analyze the execution details of a slow-running query in Snowflake?

A.DESCRIBE TABLE.
B.SHOW WAREHOUSES.
C.Query Profile.
D.SYSTEM$ABORT_QUERY.
AnswerC

The Query Profile is the dedicated interface in the Snowflake console for analyzing the performance of a query. It provides a detailed breakdown of the execution steps, allowing users to identify where time is being spent, such as in data scanning, joins, or remote disk spilling during query execution.

Why this answer

The Query Profile is the primary tool for visualizing the execution plan and performance metrics of a query. It provides a breakdown of each stage, including the time spent on data scanning, joins, and aggregations. Accessing this through the Snowflake UI or the `GET_QUERY_OPERATOR_STATS` function is essential for identifying bottlenecks and understanding how the optimizer handled the query, which is a prerequisite for effective performance tuning and optimization efforts.

Exam trap

Candidates often suggest checking the 'Query History' tab alone. While it shows status, it does not provide the visual execution plan or stage-by-stage metrics found in the Query Profile.

21
MCQeasy

A data analyst runs a query that filters on a DATE column and returns a small number of rows from a large table. The Query Profile shows a TableScan operator with a high percentage of partitions scanned. The analyst wants to reduce the number of partitions scanned without changing the query result. What should the analyst do?

A.Create a materialized view that pre-aggregates the data by DATE.
B.Add a cluster key on the DATE column to improve partition pruning.
C.Use the RESULT_SCAN function to retrieve cached results from a previous similar query.
D.Increase the warehouse size to enable more parallel scans of the table.
AnswerB

Clustering on the DATE column co-locates rows with similar dates into the same micro-partitions, allowing the optimizer to prune partitions more effectively when filtering on that column. This directly reduces the partitions scanned and improves performance for selective date filters. It does not change the query result, only the physical layout, making it the appropriate action.

Why this answer

Partition pruning relies on the natural ordering of data within micro-partitions. When a table is not clustered on the filter column, the optimizer may scan many partitions because matching rows are spread across them. Adding a cluster key on the DATE column reorganizes the data so that each micro-partition contains a narrow range of dates, enabling effective pruning.

This reduces I/O and improves performance without altering the query semantics. Other options either add resources or change the query pattern but do not directly reduce partitions scanned.

Exam trap

The trap here is thinking that a larger warehouse reduces the number of partitions scanned, when it only adds compute power to scan the same partitions faster.

22
Multi-Selectmedium

Which TWO conditions must be met for the Query Acceleration Service (QAS) to boost the performance of a query?

Select 2 answers
A.The query must involve complex window functions or recursive CTEs.
B.The query must be identified by the system as having a large scan component.
C.The virtual warehouse must have the ENABLE_QUERY_ACCELERATION parameter set to TRUE.
D.The table being queried must be a clustered table.
E.The query results must be larger than 100 GB.
AnswersB, C

Snowflake's optimizer determines if a query is eligible for QAS based on whether it needs to scan a massive number of micro-partitions. If a query only processes a small amount of data, the overhead of coordinating with the acceleration service would not provide any benefit.

Why this answer

The Query Acceleration Service (QAS) acts like a 'turbocharger' by offloading parts of a query to a shared pool of compute resources. It is specifically designed for queries that are bottlenecked by scanning large amounts of data or performing heavy filtering, and the warehouse must have QAS enabled with a valid scale factor.

Exam trap

Candidates often assume QAS automatically accelerates all queries. They miss that it only triggers for specific scan-heavy operations and requires the explicit warehouse parameter to be set.

23
MCQeasy

A data engineer is analyzing a slow query and notices that the Query Profile shows a high percentage of time spent in 'TableScan' with many partitions scanned but few rows returned. Which action is most likely to improve performance?

A.Enable the Search Optimization Service on all columns.
B.Use a larger warehouse with more clusters.
C.Add a clustering key on the columns used in the filter predicates.
D.Increase the size of the virtual warehouse.
AnswerC

Clustering reorganizes the micro-partitions so that data with similar values is stored together. This improves partition pruning, reducing the number of partitions scanned for filter predicates. In this scenario, the high number of partitions scanned indicates poor pruning, which clustering can directly address.

Why this answer

The Query Profile indicates excessive partitions scanned, which is a sign of poor partition pruning. Clustering the table on the filter columns can co-locate similar values, allowing the optimizer to skip more partitions. Increasing warehouse size or clusters does not reduce the amount of data read, and enabling Search Optimization on all columns is not a focused fix.

Exam trap

The trap here is thinking that more compute resources (larger warehouse or more clusters) will solve a data scanning inefficiency, when the real fix is improving partition pruning.

24
MCQhard

Which of the following describes the behavior of Snowflake's 'Query Profile' when encountering a join that produces a large Cartesian product?

A.The query optimizer automatically detects the Cartesian product and rejects the SQL.
B.The Query Profile shows a massive increase in rows at the join operator compared to inputs.
C.The Query Profile automatically suggests a specific WHERE clause to fix the join.
D.The Query Profile reports a 'Cartesian Product Error' and halts execution.
AnswerB

A Cartesian product is visually identified in the Query Profile by a sudden, massive jump in the number of rows processed by the join operator. This mismatch between the input row counts and the output row count is a definitive indicator of an accidental cross-join that requires immediate query refactoring.

Why this answer

A Cartesian product occurs when a join lacks a proper join condition, causing each row in one table to match every row in the other. This results in a massive explosion of intermediate records. The Query Profile clearly shows this as a 'Join' operator with a high number of output rows compared to the input.

Recognizing this pattern is vital for debugging performance issues, as these joins are almost always unintentional and cause severe latency.

Exam trap

Candidates often look for 'high memory usage' as the primary indicator, ignoring the 'join operator' row count discrepancy which is the definitive visual sign of a Cartesian product.

25
MCQeasy

What is the most efficient way to perform a bulk load of data into Snowflake from a local file system?

A.Execute multiple individual INSERT INTO statements in a transaction.
B.Use the COPY INTO command to load data from an internal or external stage.
C.Use the Snowflake UI 'Load Data' wizard for all production workloads.
D.Use an external table to query the data without loading it into Snowflake.
AnswerB

The COPY INTO command is the standard and most performant method for loading data. It leverages Snowflake's massively parallel processing architecture to ingest files from a stage, providing high throughput and the ability to handle large volumes of data efficiently while minimizing compute consumption and total latency.

Why this answer

The recommended approach for bulk loading is to use an internal stage or external cloud storage combined with the COPY INTO command. This pattern separates the data staging from the loading process, allowing for parallel processing and robust error handling. Understanding this workflow is fundamental to data engineering on Snowflake, as it optimizes throughput and minimizes the overhead associated with inserting data via individual DML statements, which is inefficient.

Exam trap

Candidates frequently choose individual INSERT statements or slow procedural loops for bulk loading, ignoring the speed and efficiency of staged COPY INTO operations.

26
MCQeasy

What is the primary benefit of using a Search Optimization Service (SOS) in Snowflake?

A.It speeds up complex joins and aggregations.
B.It significantly improves the performance of point-lookup queries.
C.It automatically compresses data to reduce storage costs.
D.It allows multiple users to write to the same table simultaneously.
AnswerB

Search Optimization Service creates and maintains a persistent index on specific columns, which allows for very fast retrieval of individual records. This service is specifically built for point-lookup queries, drastically reducing the latency for finding a few rows in a table containing millions or billions of total rows.

Why this answer

The Search Optimization Service is designed to accelerate point-lookup queries that return a single row or a small subset of rows. By maintaining a persistent index of the data in the background, SOS allows the query optimizer to skip irrelevant micro-partitions and navigate directly to the specific data requested. This is crucial for applications that require low-latency response times for highly specific lookups on massive datasets, significantly reducing the compute load for those specific query patterns.

Exam trap

Candidates frequently confuse the Search Optimization Service with clustering keys or standard indexes, failing to identify SOS as the tool for point-lookups.

27
MCQmedium

A data engineer runs a query that joins a large fact table to a small dimension table. The Query Profile shows a Cartesian join with massive intermediate row counts. The join condition in the SQL is `ON fact.dim_id = dim.id`. The dimension table has a primary key on `id` and the fact table has a foreign key referencing it, but neither constraint is enforced. Which action will most reliably eliminate the Cartesian join and produce the expected result?

A.Increase the size of the virtual warehouse to provide more memory for the join operation.
B.Rewrite the join to use `NATURAL JOIN` so Snowflake automatically infers the join key from matching column names.
C.Add a `CLUSTER BY` clause on the fact table's `dim_id` column to improve join locality.
D.Ensure the join predicate is actually included in the query and that the dimension table's `id` column is not wrapped in a function or cast that prevents hash-join matching.
AnswerD

A Cartesian join in the Query Profile typically means the optimizer could not derive an equi-join condition. This happens when the predicate is missing, commented out, or when one side is wrapped in a non-sargable expression such as `CAST(dim.id AS VARCHAR)`. Verifying the predicate is present and that both sides are directly comparable allows Snowflake to choose a hash join and eliminate the cross-product.

Why this answer

A Cartesian join in the Query Profile almost always indicates the optimizer could not identify an equi-join predicate. Common causes include a missing or mistyped join condition, or a function or cast applied to the join column on one side, which prevents hash-join matching. Confirming the predicate exists and that both columns are directly comparable restores the intended hash join.

Clustering, natural joins, and warehouse resizing do not fix join semantics.

Exam trap

The trap here is assuming that a Cartesian join is a performance problem solved by scaling the warehouse, when it is actually a logical plan problem caused by an ineffective or missing join predicate.

28
Multi-Selecthard

A data engineer is optimizing a complex query that joins multiple large tables and applies several aggregations. The Query Profile shows significant time spent in the Join and Aggregate operators, and the warehouse is sized appropriately. Which TWO actions should the engineer take to improve performance? (Choose two.)

Select 2 answers
A.Collect statistics on the join keys and filter columns.
B.Use a larger virtual warehouse to increase compute resources.
C.Ensure that the join keys are of the same data type and avoid implicit casting.
D.Add search optimization service to the tables involved in the join.
E.Rewrite the query to use temporary tables for intermediate results.
AnswersA, C

Collecting statistics on join keys and filter columns provides the optimizer with accurate cardinality estimates, enabling it to choose better join orders and aggregation strategies. This can reduce the amount of data shuffled and processed, directly improving the performance of Join and Aggregate operators. It is a key tuning step for complex queries.

Why this answer

The query is experiencing bottlenecks in join and aggregation operations despite adequate warehouse size. Collecting statistics on join keys and filter columns gives the optimizer the information it needs to generate a more efficient plan, such as choosing the optimal join order and aggregation method. Additionally, ensuring that join keys have the same data type avoids implicit casting, which can hinder performance by preventing the use of efficient join algorithms.

Together, these actions address the root causes of the performance issue.

Exam trap

The trap here is assuming that increasing warehouse size or adding search optimization will solve join and aggregation bottlenecks, when the real issue is often missing statistics or data type mismatches.

29
MCQmedium

A data engineer is building a transformation pipeline that processes semi-structured JSON data. The pipeline needs to extract values from nested objects and arrays and output a relational table. The engineer wants to minimize manual coding and ensure the transformation is maintainable. Which Snowflake feature should the engineer use?

A.The PARSE_JSON function to convert the JSON into a relational table automatically.
B.The OBJECT_CONSTRUCT function to build a relational schema from the JSON keys.
C.The TRY_CAST function to coerce the entire JSON column into a relational table.
D.The FLATTEN function with LATERAL joins to explode arrays and extract nested fields.
AnswerD

FLATTEN is a table function that takes a VARIANT column and produces one row per element in an array or per key-value pair in an object. Used with LATERAL, it can explode nested arrays and objects into relational rows. This is the standard Snowflake approach for transforming semi-structured data into a relational format, and it is maintainable and flexible for nested structures.

Why this answer

FLATTEN is designed to transform semi-structured data by expanding arrays and objects into rows. When combined with LATERAL, it can be applied to each row of a base table, producing a relational output that includes the exploded elements. This approach handles nested structures and is more maintainable than manual string parsing or repeated path expressions.

PARSE_JSON only parses text into VARIANT, while OBJECT_CONSTRUCT and TRY_CAST serve different purposes. FLATTEN is the correct feature for relational transformation of JSON.

Exam trap

The trap here is assuming that PARSE_JSON or OBJECT_CONSTRUCT can flatten nested JSON, when they only parse or construct semi-structured values without relational expansion.

30
Multi-Selecthard

A data engineer is optimizing a transformation pipeline and wants to reduce compute cost and improve performance for queries that repeatedly scan the same large table with different filters. Which TWO Snowflake features or techniques directly support this goal? (Choose two.)

Select 2 answers
A.Create a materialized view that pre-aggregates the filtered results.
B.Define a clustering key on the columns most frequently used in WHERE predicates.
C.Disable the result cache at the account level to force fresh execution.
D.Convert the table to a transient table to avoid fail-safe storage charges.
E.Increase the STATEMENT_TIMEOUT_IN_SECONDS parameter for the session.
AnswersA, B

A materialized view stores precomputed results and is automatically maintained by Snowflake, so repeated queries against the same aggregated data avoid rescanning the base table. Snowflake can also rewrite eligible queries to use the materialized view. This reduces compute for recurring aggregation patterns, directly supporting the stated optimization goal.

Why this answer

Clustering and materialized views both attack the cost of repeated scans. Clustering reduces the micro-partitions read by improving pruning on filtered columns, while materialized views precompute and maintain aggregated results so recurring queries avoid touching the base table. Together they cut compute for the described pattern, whereas timeout settings, cache disabling, and transient storage do not improve scan efficiency.

Exam trap

The trap here is confusing cost-control or storage settings with genuine query-performance features, since parameters like timeouts and table types sound optimization-adjacent but do not reduce scanned data.

31
MCQeasy

A data analyst runs a dashboard query that aggregates sales by region for the current month. The query has run successfully many times today, but the analyst notices it is returning results in under a second even though the underlying table is very large. The analyst has not changed the query or the data. Which Snowflake feature is most likely responsible for the fast response?

A.Result caching has stored the query result, and the query is being served from the persisted result cache.
B.The query is using the local disk cache on the virtual warehouse.
C.The table is clustered on the region column, allowing partition pruning.
D.The virtual warehouse is configured with a large multi-cluster size.
AnswerA

Snowflake's result cache stores the output of every query for 24 hours. If the same query is re-executed and the underlying data has not changed, Snowflake returns the cached result without re-running the query. This explains the sub-second response for a repeated aggregation on a large table. The cache is invalidated when the data changes or when certain session parameters differ, but in this scenario the analyst has not changed anything.

Why this answer

Result caching in Snowflake stores the complete output of a query for 24 hours. When the same query is re-run and the underlying data has not changed, Snowflake returns the cached result directly without using a warehouse. This yields sub-second response times even for large aggregations.

Clustering, warehouse size, and local disk cache all affect query execution speed but do not store final results, so they cannot explain the instant response.

Exam trap

The trap here is attributing fast repeated queries to warehouse size or clustering, when the persisted result cache is designed to return identical query results without any compute.

32
MCQeasy

A data engineer needs to transform semi-structured data stored in a VARIANT column. The engineer wants to extract a scalar value from a JSON object and use it in a relational query. Which Snowflake feature should the engineer use?

A.Use the TO_VARCHAR function to cast the entire VARIANT to a string and then use a JSON parser.
B.Use the colon operator (:) to access the value by key, for example variant_column:key_name.
C.Use the FLATTEN function to explode the JSON object into rows.
D.Use the PARSE_JSON function to convert the VARIANT to a string and then use string functions.
AnswerB

The colon operator allows direct access to a value within a VARIANT column using a key or path. For a JSON object, `variant_column:key_name` returns the value associated with that key. This is the simplest and most efficient way to extract a scalar value for use in a relational query. It is a core feature of Snowflake's semi-structured data support and does not require additional functions or table functions.

Why this answer

The colon operator is the standard way to access a scalar value within a VARIANT column in Snowflake. It allows direct key-based access without the need for additional parsing or row expansion, making it ideal for extracting a single value for relational queries.

Exam trap

The trap here is overcomplicating the extraction by using FLATTEN or string conversion when a simple path expression is sufficient and more efficient.

33
MCQmedium

A data engineer notices that a query on a large table is consistently slow despite the table being clustered. The query filters on a column that is not part of the clustering key. What is the most efficient way to improve performance for this query?

A.Increase the virtual warehouse size.
B.Create a materialized view on the column.
C.Redefine the clustering key to include the filter column.
D.Convert the table to a temporary table.
AnswerC

Redefining the clustering key to include the filter column allows Snowflake to reorganize the data into micro-partitions that align with the filter criteria. This enables partition pruning, which significantly reduces the total volume of data read from storage, directly addressing the root cause of the query performance bottleneck.

Why this answer

Improving performance requires minimizing the amount of data scanned during query execution. Since the existing clustering key does not align with the query filter, Snowflake must scan more micro-partitions than necessary. By redefining or adding a clustering key that aligns with the frequently used filter column, the query optimizer can prune unnecessary partitions effectively.

This process reduces I/O overhead and significantly speeds up query execution, demonstrating the vital role of data layout in performance.

Exam trap

Many candidates incorrectly suggest creating a secondary index, which does not exist in Snowflake. Others suggest changing the warehouse size, which is inefficient compared to fixing the data layout first.

34
MCQhard

A data engineer notices that a query performing a large aggregation is spilling to remote disk. The warehouse is a 2XL multi-cluster warehouse with maximum clusters set to 4. The engineer wants to reduce spilling and improve performance without increasing the warehouse size. Which action should the engineer take?

A.Rewrite the query to use a smaller aggregation or break it into stages.
B.Increase the maximum cluster count to 8.
C.Enable the query acceleration service for the warehouse.
D.Add a clustering key on the group by columns.
AnswerA

Spilling to remote disk indicates that the aggregation operation requires more memory than available on the warehouse nodes. Rewriting the query to reduce the memory footprint, such as by pre-aggregating data in stages or using smaller groups, can decrease the memory required and avoid spilling. This directly addresses the root cause without increasing warehouse size.

Why this answer

Remote disk spilling occurs when the aggregation operation cannot fit its intermediate results in memory. The most direct way to reduce spilling without increasing warehouse size is to reduce the memory demand of the query itself. Rewriting the query to perform smaller aggregations or breaking it into stages can lower the peak memory usage, allowing the operation to complete within the available memory.

This addresses the underlying issue rather than trying to work around it with additional resources.

Exam trap

The trap here is assuming that adding more clusters or enabling query acceleration will help a single query that is spilling, when in fact those features address concurrency or specific query patterns, not memory-intensive operations.

35
MCQmedium

A data engineer has a large table SALES_RAW with a VARIANT column PAYLOAD that stores semi-structured JSON. The engineer needs to flatten an array of product objects inside PAYLOAD into separate rows, keeping all other columns intact. Which Snowflake construct should be used in the SELECT statement to achieve this?

A.LATERAL FLATTEN(input => PAYLOAD:products)
B.PARSE_JSON(PAYLOAD):products
C.ARRAY_AGG(PAYLOAD:products)
D.OBJECT_CONSTRUCT('products', PAYLOAD:products)
AnswerA

LATERAL FLATTEN is the correct Snowflake table function that expands an array or object into multiple rows, and using it with a lateral join preserves the original row's columns. It accepts an input expression such as PAYLOAD:products and produces one row per array element, which is exactly what this scenario requires.

Why this answer

The LATERAL FLATTEN table function is the standard Snowflake mechanism for expanding semi-structured arrays into rows while keeping the parent row's other columns. It accepts a VARIANT input and returns one row per element, making it ideal for converting nested JSON into a relational result set without losing context.

Exam trap

The trap here is confusing functions that manipulate semi-structured data (like OBJECT_CONSTRUCT or ARRAY_AGG) with the specific table function that performs row expansion.

36
MCQmedium

A Snowflake analyst runs a query that aggregates sales by region over the last 30 days. The query takes 40 seconds on an X-Small warehouse. The analyst then reruns the exact same query 10 minutes later without any data changes. It completes in 1 second. Which Snowflake feature explains this behavior?

A.Warehouse Auto-Suspend
B.Result Cache
C.Metadata Cache
D.Local Disk Cache
AnswerB

Result Cache stores the output of a query in the Cloud Services layer for 24 hours (or until the underlying data changes). Since the same query text was rerun and micro-partitions had no changes, Snowflake returned the cached result set without re-executing the query on the virtual warehouse. This is why the second run completed in 1 second.

Why this answer

The dramatic speedup on an identical query with unchanged data is the signature of Result Cache. Snowflake stores the result set in the Cloud Services layer, so a repeat query is served without engaging the virtual warehouse. Local disk and metadata caches accelerate data scanning and pruning but still require query execution, and auto-suspend does not cache results.

Exam trap

The trap here is confusing Result Cache with Local Disk Cache, since both improve performance on repeated queries but only Result Cache stores the final result set.

37
MCQmedium

When loading data into Snowflake using the COPY INTO command, what is the impact of using the 'STRIP_OUTER_ARRAY = TRUE' file format option for JSON files?

A.It removes all square brackets from within the JSON data structure.
B.It allows Snowflake to load each element of a top-level array as a separate row.
C.It converts semi-structured JSON arrays into a comma-separated string.
D.It improves performance by compressing the JSON file during the load.
AnswerB

When a JSON file contains multiple records wrapped in a single array (e.g., [{},{},{}]), setting this option to TRUE instructs Snowflake to remove the brackets and load each object as its own distinct row. This is essential for standardizing data ingestion from many API-based sources.

Why this answer

Snowflake provides various transformation options during the ingestion process to simplify the data structure. The STRIP_OUTER_ARRAY option is particularly useful for JSON files where the entire content is wrapped in a single array. Removing this array allows Snowflake to treat each element as a separate record for ingestion.

Exam trap

Candidates often assume that stripping the outer array will merge all JSON objects into a single large record, rather than correctly identifying that it flattens the array structure.

38
Multi-Selecthard

A data engineer is optimizing a complex query that joins five large tables and includes multiple aggregations. The Query Profile shows significant time spent in the Join and Aggregate nodes, and the engineer wants to reduce the amount of data processed. Which TWO techniques are most appropriate for improving performance in this scenario? (Choose two.)

Select 2 answers
A.Use `EXPLAIN` to inspect the query plan and identify steps that process disproportionately large row counts.
B.Replace all joins with `UNION ALL` to combine the tables into a single result set.
C.Apply filters as early as possible in the query, ideally in a subquery or CTE, to reduce the row count before joins.
D.Increase the warehouse size to a 4X-Large to provide more memory for the joins.
E.Convert all `JOIN` clauses to `CROSS JOIN` to allow the optimizer more flexibility.
AnswersA, C

`EXPLAIN` provides the logical execution plan without running the query, showing operators and estimated costs. By inspecting the plan, the engineer can spot steps like Cartesian joins, unnecessary aggregations, or missing filters that cause large intermediate results. This diagnostic step guides targeted optimizations such as adding predicates or rewriting joins. It is a best practice for understanding where the optimizer is spending effort and where data volume explodes.

Why this answer

Early filtering reduces the number of rows entering joins and aggregations, directly cutting the data volume that flows through the plan. Using `EXPLAIN` reveals which operators process the most rows, allowing targeted fixes. Together, these techniques address the root cause of heavy Join and Aggregate nodes.

Replacing joins with `UNION ALL`, scaling the warehouse, or using `CROSS JOIN` either changes semantics, fails to reduce data volume, or makes the problem worse.

Exam trap

The trap here is thinking that a larger warehouse solves a data-volume problem; scaling compute does not reduce the rows processed by joins and aggregations.

39
MCQmedium

A finance analyst runs a monthly report that aggregates 18 months of sales data. The report executes 40 times per day, and each run currently takes 4 minutes on a medium warehouse. The underlying tables are loaded once nightly. Which approach most effectively reduces compute cost for this workload?

A.Enable the result cache by ensuring the query text and session context are identical across runs.
B.Set the warehouse to auto-suspend after 60 seconds to avoid idle credits.
C.Create a separate virtual warehouse for the analyst and enable multi-cluster scaling.
D.Resize the warehouse to 4X-Large so each run finishes faster.
AnswerA

Because the tables change only nightly, identical query text run repeatedly during the day can be served from the result cache at no compute cost after the first execution. Keeping the SQL text and relevant session parameters consistent allows cache reuse, cutting 39 of 40 daily executions to near-zero credits. This is the most direct cost reduction for a repetitive, read-only report.

Why this answer

The tables are static during the business day, so the 40 daily executions read identical data. Ensuring identical query text and session context lets Snowflake serve subsequent runs from the result cache without provisioning compute, eliminating nearly all of the recurring cost. Resizing, auto-suspend tuning, and multi-cluster scaling change resource behavior but do not remove the redundant scans.

Exam trap

The trap here is treating a speed problem as the issue, when the workload is actually a redundancy problem that result caching solves for free.

40
Multi-Selectmedium

A data engineer is writing a transformation that reads a VARIANT column containing nested arrays of objects and needs to produce one output row per array element. Which TWO Snowflake features or functions should be used to accomplish this? (Choose two.)

Select 2 answers
A.Use the VALUE column returned by FLATTEN to access each element's contents.
B.Use the LATERAL FLATTEN construct with the input argument set to the VARIANT array path.
C.Use OBJECT_CONSTRUCT to iterate over the array and emit one row per element.
D.Use PARSE_JSON to convert the array into a relational table with one column per object attribute.
E.Use GET_PATH to extract the array and then join it to a sequence generator to produce rows.
AnswersA, B

When FLATTEN expands an array, the VALUE column holds the element itself, which for an array of objects is a VARIANT object. Referencing VALUE and then using the colon path syntax extracts individual attributes from each object. This is how the exploded rows are turned into relational columns.

Why this answer

FLATTEN is the built-in table function that turns a VARIANT array into rows, and when applied laterally it is evaluated per input row. The VALUE column of the FLATTEN output holds each array element, which for an array of objects is itself a VARIANT object that can be dereferenced with the colon path syntax. Together they transform nested arrays into a relational shape without manual iteration.

Exam trap

The trap here is reaching for JSON parsing or object construction functions to reshape nested data, when row generation from an array is specifically the job of the FLATTEN table function.

41
MCQmedium

A data engineer needs to transform semi-structured JSON data stored in a VARIANT column into a relational table. The JSON contains nested arrays and objects. Which Snowflake feature should be used to flatten the arrays into separate rows while preserving the parent-child relationship?

A.PARSE_JSON
B.LATERAL FLATTEN
C.ARRAY_AGG
D.OBJECT_CONSTRUCT
AnswerB

LATERAL FLATTEN is a table function that expands nested arrays or objects in a VARIANT column into multiple rows. When used in the FROM clause with a lateral join, it preserves the correlation with the parent row, allowing each element of the array to become a separate row while retaining other columns from the original row. This is the standard method for normalizing semi-structured data.

Why this answer

LATERAL FLATTEN is designed to explode nested arrays and objects into rows while maintaining the association with the source row. It is the correct tool for transforming semi-structured data into a relational format. The other functions either construct objects, aggregate into arrays, or parse strings, none of which expand arrays into multiple rows.

Exam trap

The trap here is confusing functions that manipulate semi-structured data with those that generate rows; only LATERAL FLATTEN produces the row expansion needed.

42
MCQmedium

What is the benefit of using clustering keys for a table that is queried using range filters?

A.It eliminates the need for a virtual warehouse.
B.It enables efficient partition pruning.
C.It forces the query to use the result cache.
D.It speeds up DML operations like INSERT.
AnswerB

Clustering keys ensure that data within a range is grouped into the same or adjacent micro-partitions. This allows the query optimizer to use metadata to prune (skip) micro-partitions that do not contain data within the requested range, significantly reducing the amount of data read from persistent storage.

Why this answer

Range filters require scanning segments of data defined by start and end values. Without proper clustering, the engine must perform a full table scan. With clustering keys, the table data is physically sorted or organized into micro-partitions based on the key values.

This allows the query optimizer to identify and read only the specific micro-partitions that fall within the range, drastically decreasing I/O and improving query speed for range-based analytical tasks.

Exam trap

Candidates often confuse clustering with sorting data for display purposes. They miss the core mechanism of 'partition pruning,' which is the specific performance benefit of clustering in Snowflake's architecture.

43
MCQeasy

Which Snowflake feature allows a user to retrieve the results of a query that was executed 10 minutes ago without consuming additional virtual warehouse credits?

A.Metadata Cache
B.Virtual Warehouse Local Cache
C.Result Set Cache
D.Search Optimization Service
AnswerC

Result Set Cache is a global cache that persists query results for 24 hours. When a query is repeated and the data is unchanged, Snowflake retrieves the result directly from this cache without starting or utilizing a virtual warehouse, effectively making the query execution free of charge.

Why this answer

The Result Set Cache stores the results of queries for 24 hours. If the same query is executed again, the underlying data has not changed, and the query meets certain criteria, Snowflake returns the result directly from the cache. This bypasses the virtual warehouse, resulting in faster response times and zero compute cost.

Exam trap

Test-takers frequently mistake time travel for the result set cache, confusing historical data querying with the zero-cost caching of identical recent queries.

44
MCQmedium

A user wants to create a table that automatically stays up-to-date with a complex transformation from a source table. The transformation involves multiple joins and aggregations. Which Snowflake object is best suited for this, assuming the user prioritizes ease of management and low latency?

A.Materialized View
B.Dynamic Table
C.Standard View
D.External Table
AnswerB

Dynamic tables allow users to define the results of a query as a table and specify a 'target lag' for freshness. Snowflake automatically handles the complex refresh logic, including joins and aggregations, making it the most efficient and manageable way to handle continuously updated, complex data transformations.

Why this answer

Dynamic Tables represent a shift toward declarative data engineering in Snowflake. Unlike Materialized Views, which have strict limitations on joins and functions, or Tasks/Streams, which require manual orchestration, Dynamic Tables automatically manage the refresh process based on a target lag, simplifying the management of complex data pipelines.

Exam trap

Test-takers often confuse Materialized Views with Dynamic Tables, forgetting that Materialized Views have strict join limitations while Dynamic Tables handle complex transformations seamlessly.

45
MCQeasy

A user runs a query that filters on a column with a high cardinality and the table is not clustered. The query scans a large number of micro-partitions. Which action would most directly reduce the number of micro-partitions scanned?

A.Add a clustering key on the filtered column.
B.Use a larger warehouse with multi-cluster scaling.
C.Increase the size of the virtual warehouse.
D.Enable result caching for the session.
AnswerA

Clustering keys reorganize the micro-partitions so that data with similar values is stored together. When a query filters on the clustered column, the optimizer can use the clustering metadata to prune micro-partitions that do not contain the filter value. This directly reduces the number of micro-partitions scanned, improving performance for high-cardinality columns.

Why this answer

Clustering keys physically sort data so that similar values are co-located in micro-partitions. This enables the optimizer to prune partitions based on filter predicates, directly reducing the number of micro-partitions scanned. Larger warehouses or caching do not change the volume of data scanned for the initial query.

Exam trap

The trap here is thinking that a bigger warehouse reduces data scanned; it only makes scanning faster, not narrower.

46
MCQhard

A data engineer needs to transform a JSON column stored in a VARIANT type into a relational table. The JSON contains a top-level array of objects, each with keys `id`, `name`, and `tags`, where `tags` is itself an array of strings. The engineer wants each object to become a row, with the `tags` array flattened into a separate column containing one tag per row. Which combination of Snowflake functions will produce one row per tag while preserving `id` and `name`?

A.`ARRAY_TO_STRING(json_col:tags, ',')` followed by `SPLIT_TO_TABLE` on the resulting string.
B.`OBJECT_KEYS(json_col)` to extract the array elements, then `GET` to access each tag.
C.`LATERAL FLATTEN(input => json_col:tags)` combined with `json_col:id::INT` and `json_col:name::STRING` in the SELECT list.
D.`PARSE_JSON` on the VARIANT column followed by `FLATTEN` on the entire JSON object.
AnswerC

`LATERAL FLATTEN` is designed to explode an array into multiple rows. When applied to `json_col:tags`, it produces one row per element of the tags array. The outer query can still reference `json_col:id` and `json_col:name` because the lateral join preserves the original row context. This yields exactly one row per tag with the corresponding id and name, which matches the requirement.

Why this answer

To explode a nested array within a VARIANT column, `LATERAL FLATTEN` is the correct tool. It takes an array as input and returns one row per element, while the lateral join keeps the original row's other columns accessible. Referencing `json_col:id` and `json_col:name` in the SELECT list preserves those attributes.

Other functions either treat the array as a string, operate on object keys, or flatten the wrong level of the JSON structure, so they do not produce the required one-row-per-tag output.

Exam trap

The trap here is confusing object-key extraction with array flattening; `OBJECT_KEYS` works on objects, while `FLATTEN` is required for arrays.

47
MCQeasy

A developer needs to flatten a VARIANT column named payload that contains a nested JSON array of order line items into individual rows, preserving the parent order attributes alongside each line item. Which Snowflake construct accomplishes this in a single SELECT statement?

A.A PARSE_JSON call applied to the payload column in the SELECT list.
B.A LATERAL FLATTEN of the payload:line_items array joined back to the parent row.
C.A recursive common table expression that walks the JSON hierarchy level by level.
D.A GROUP BY on the VARIANT column with an ARRAY_AGG of the line items.
AnswerB

LATERAL FLATTEN is the native Snowflake table function that expands a VARIANT array or object into one row per element, and using it as a lateral join preserves the parent row's columns. This directly satisfies the requirement to produce one row per line item while retaining order-level attributes, all within a single SELECT statement.

Why this answer

LATERAL FLATTEN is Snowflake's dedicated mechanism for exploding semi-structured arrays and objects into relational rows. Used laterally, it correlates each element with its parent row, so order attributes remain available alongside each line item. This yields a fully relational result set from nested JSON in one statement without manual recursion or aggregation.

Exam trap

The trap here is reaching for generic SQL techniques such as recursive CTEs or aggregation when Snowflake provides a purpose-built FLATTEN table function for semi-structured data.

48
MCQmedium

A query that previously ran in 5 seconds now takes 2 minutes. The Query Profile shows that most of the time is spent in 'Remote Disk I/O'. What is the most likely cause for this performance degradation?

A.The warehouse is under-provisioned and needs to be scaled up.
B.The warehouse cache was cleared or the data was not in the local cache.
C.The query is experiencing resource contention from other users.
D.The table has too many micro-partitions and needs to be deleted.
AnswerB

Snowflake warehouses use local SSDs to cache data from micro-partitions. When a warehouse is resumed after being suspended, or if it has not queried this data recently, it must fetch the data from remote cloud storage. This 'cold' cache scenario results in significant Remote Disk I/O and slower performance.

Why this answer

Understanding where time is spent in the Query Profile is critical for troubleshooting performance issues. Remote Disk I/O indicates that the virtual warehouse is reading data from cloud storage rather than its local SSD cache. This usually happens when the cache is 'cold' or when the data volume exceeds the cache capacity.

Exam trap

Test-takers frequently assume performance degradation stems from warehouse sizing issues rather than recognizing that a cold cache forces expensive remote disk I/O operations.

49
MCQmedium

A query is failing with the error 'Can\'t compile the query as it is too large'. Which action is most likely to resolve this issue while maintaining the query's logical intent?

A.Increase the size of the virtual warehouse to 4X-Large.
B.Break the query into smaller parts using temporary tables or CTEs.
C.Use the Search Optimization Service on the underlying tables.
D.Disable the use of micro-partition pruning for that specific session.
AnswerB

Simplifying the query by breaking it into smaller, manageable chunks or using temporary tables to store intermediate results reduces the complexity the compiler must handle at once. This often resolves 'query too large' errors while keeping the logic identical for the final output.

Why this answer

Snowflake has limits on the complexity of a single SQL statement's compilation. Very large queries with thousands of lines or deeply nested subqueries can hit memory limits in the Cloud Services layer. Simplifying the query structure or breaking it into smaller pieces is the standard approach to resolving compilation errors.

Exam trap

Candidates often suggest increasing the warehouse size, which does not solve compilation-related errors caused by overly complex SQL structures or excessive query size.

50
MCQmedium

A developer is performing a large data load using the COPY INTO command. The load is taking longer than expected. Which action should be taken to optimize this load?

A.Reduce the size of the virtual warehouse.
B.Split large files into smaller, equal-sized chunks.
C.Change the file format to JSON.
D.Disable auto-clustering on the target table.
AnswerB

Snowflake achieves high-performance loading by parallelizing the execution of the COPY command across multiple nodes. By breaking down large files into smaller, optimally sized files (ideally 100MB to 250MB), the process can distribute the workload more effectively across the available compute cluster nodes, resulting in much faster load completion.

Why this answer

Optimizing bulk data loads involves ensuring the data is split into appropriately sized files to maximize parallelism during the ingestion process. Snowflake’s COPY command can leverage multiple warehouse nodes if the input files are partitioned effectively. By ensuring that the files are roughly 100MB to 250MB each, the load process can be distributed across the available nodes in the virtual warehouse, leading to significant reductions in the overall time required to complete the load.

Exam trap

Candidates frequently suggest increasing the warehouse size to speed up the load. While this helps, the most fundamental optimization for COPY INTO is ensuring file sizes enable maximum parallel processing.

51
MCQeasy

A data engineer needs to transform a table by unpivoting columns Q1, Q2, Q3, Q4 into rows with a quarter label and sales amount. Which Snowflake SQL construct is designed for this task?

A.LATERAL FLATTEN
B.PIVOT
C.UNPIVOT
D.ARRAY_AGG
AnswerC

UNPIVOT is specifically designed to transform columns into rows, converting a wide table into a long format. It takes a set of columns and produces one row per column per original row, along with a label column and a value column. This matches the requirement to unpivot Q1 through Q4 into quarter labels and sales amounts.

Why this answer

The UNPIVOT operator in Snowflake is the correct tool for converting columns into rows. It takes a list of columns and produces a result set with one row per column per original row, including a label column and a value column. This is exactly what is needed to transform Q1, Q2, Q3, Q4 into quarter labels and sales amounts.

Exam trap

The trap here is confusing PIVOT and UNPIVOT; PIVOT goes from rows to columns, while UNPIVOT goes from columns to rows.

52
MCQeasy

Which technique is recommended to improve the performance of a query that must frequently filter data based on values within a VARIANT column containing JSON data?

A.Convert the JSON into a single large string and use LIKE operators.
B.Create a separate table for every key-value pair in the JSON.
C.Materialize frequently used JSON keys into separate relational columns.
D.Disable the use of the result cache for all JSON-based queries.
AnswerC

By extracting common JSON keys into standard relational columns (either during ingestion or via a view/dynamic table), Snowflake can better utilize micro-partition pruning. This allows the query engine to skip data more effectively, resulting in faster performance for filters on those specific fields.

Why this answer

Querying semi-structured data is efficient in Snowflake, but performance can be further enhanced by creating 'functional' elements. Since Snowflake micro-partitions store VARIANT data in a columnar fashion, extracting common fields into their own relational columns allows the engine to use standard pruning and statistics more effectively.

Exam trap

Candidates often suggest using more compute resources or caching, failing to realize that materializing keys into relational columns is the best practice for optimizing JSON query performance.

53
MCQeasy

Which function should be used to transform a single row containing a semi-structured VARIANT column with an array of objects into multiple individual rows?

A.PARSE_JSON
B.OBJECT_CONSTRUCT
C.FLATTEN
D.STRIP_NULL_VALUE
AnswerC

The FLATTEN function takes a semi-structured column (like an array or object) and explodes it into multiple rows. Each element of the array becomes its own row in the result set, which can then be queried using standard SQL, making it the standard tool for unnesting data.

Why this answer

Transforming semi-structured data is a core capability of Snowflake, allowing users to convert nested JSON or arrays into a relational format. The FLATTEN function is specifically designed for this purpose, enabling data analysts to join the parent row with its child elements, which is essential for reporting and traditional SQL analysis.

Exam trap

Candidates often confuse FLATTEN with PARSE_JSON or GET. While those functions access data, only FLATTEN is specifically designed to transform nested arrays into a relational set of rows.

54
MCQhard

A developer is using a Stream on a table to capture changes. If the developer executes a DML statement that consumes the data from the Stream within a transaction, what happens to the Stream's offset after the transaction commits?

A.The offset is advanced immediately when the SELECT is executed.
B.The offset is advanced only if the transaction commits successfully.
C.The offset must be manually updated using the ALTER STREAM command.
D.The Stream is dropped and must be recreated for the next batch.
AnswerB

The Stream's offset is managed transactionally. If the DML statement using the stream is part of a transaction that commits, the stream moves its pointer to the next set of changes. If the transaction rolls back, the offset remains at its original position.

Why this answer

Snowflake Streams use an offset to track the point in time from which they are reading changes. When a Stream is used as a source in a DML operation (like INSERT INTO... SELECT FROM stream), the offset is advanced only when the transaction successfully commits, ensuring 'exactly-once' processing of the change data.

Exam trap

Many candidates think a stream offset advances immediately when a query reads it, forgetting that transactional commit boundaries dictate offset advancement.

55
MCQmedium

How does Snowflake's architecture handle the storage and querying of semi-structured data like JSON to optimize performance?

A.JSON is stored as a raw BLOB and parsed at execution time.
B.Individual keys are automatically extracted into a hidden relational schema.
C.Data is compressed and stored in a columnar format based on common paths.
D.Users must manually define a schema before JSON data can be queried efficiently.
AnswerC

When JSON is ingested into a VARIANT column, Snowflake identifies common paths and stores them columnarly. This enables the optimizer to prune and only retrieve the specific data needed for a query, combining the flexibility of semi-structured data with the performance of relational storage.

Why this answer

Snowflake optimizes semi-structured data by automatically shredding it into an internal columnar format when stored in a VARIANT column. This allows the query engine to only read the specific paths or keys required by a query, similar to how it handles standard relational columns, leading to significantly better performance than traditional blob storage.

Exam trap

Candidates often assume semi-structured data is stored as flat unstructured text blobs, missing Snowflake's automatic internal columnar shredding mechanism.

56
MCQeasy

An analyst runs the same dashboard query every morning at 08:00. The query reads from tables that are loaded by an ELT job finishing at 07:30. The analyst complains that the first run takes 40 seconds while subsequent identical runs during the day return in under a second. The data in the tables does not change between the first run and the later runs. Which mechanism explains the speedup?

A.The virtual warehouse's local disk cache retained the table's micro-partitions from the first run.
B.The warehouse's query acceleration service automatically rewrote the query into a faster form after the first execution.
C.The metadata cache allowed the optimizer to skip scanning because it already knew the aggregate values.
D.The result cache returned the previously computed result because the query text and underlying data were unchanged.
AnswerD

Snowflake's result cache stores the output of a query for 24 hours and returns it directly when an identical query is submitted and the underlying micro-partitions have not changed. The first run after the 07:30 load computes and caches the result; later identical runs hit the cache and return in under a second without using a warehouse.

Why this answer

When an identical query is submitted and the underlying data has not changed, Snowflake returns the cached result instead of re-executing the query. The first morning run after the ELT job populates the cache with a 40-second result; every subsequent identical run within the 24-hour window returns that stored result in under a second. Local disk caching, metadata, and query acceleration all still require execution work.

Exam trap

The trap here is attributing fast repeat queries to warehouse caching, when the local disk cache still requires the aggregation to be recomputed and is cleared on suspend or resize.

57
Multi-Selecthard

When considering the implementation of a clustering key on a large table, which TWO scenarios indicate that clustering will provide the most significant performance benefit?

Select 2 answers
A.The table is frequently updated with small DML operations.
B.Queries against the table typically filter on a specific dimension column.
C.The table size is less than 50 GB and fits in the local cache.
D.The Query Profile shows that a large percentage of partitions are scanned.
E.The table is used exclusively for full table scans and exports.
AnswersB, D

When queries consistently use a specific column in WHERE clauses, clustering the table on that column ensures that data is physically grouped together. This maximizes the efficiency of partition pruning, as the system can quickly identify and skip micro-partitions that do not match the filter criteria.

Why this answer

Clustering is most effective for large tables (typically multi-terabyte) where query performance has degraded over time due to poor data grouping. It benefits queries that use selective filters on specific columns, as it allows the optimizer to skip a high percentage of micro-partitions that do not contain relevant data.

Exam trap

Candidates often suggest clustering for small tables. Clustering is resource-intensive and provides no benefit for small datasets where full table scans are already highly efficient and fast.

58
MCQhard

A data engineer needs to transform semi-structured data stored in a VARIANT column that contains an array of JSON objects into a relational table with one row per object. The engineer wants to use a Snowflake function that can expand the array into multiple rows. Which function should be used?

A.PARSE_JSON
B.FLATTEN
C.OBJECT_CONSTRUCT
D.ARRAY_AGG
AnswerB

FLATTEN is a table function that takes a VARIANT column and expands arrays or objects into multiple rows. It is designed exactly for this purpose, producing one row per element in the array. Using LATERAL FLATTEN allows the engineer to join the expanded rows back to the original table, achieving the desired relational format.

Why this answer

FLATTEN is the correct function to expand an array of objects into multiple rows. It is typically used in the FROM clause with LATERAL, allowing each element of the array to become a separate row while preserving access to the original row's columns. The other functions either create VARIANT values or aggregate rows, not expand arrays.

Exam trap

The trap here is confusing functions that manipulate semi-structured data with the one that specifically expands arrays into rows.

59
Multi-Selectmedium

A developer is building a Change Data Capture (CDC) pipeline using Snowflake. Which TWO features are required to ensure that only new or modified data is processed and that the processing logic runs automatically whenever data arrives?

Select 2 answers
A.Streams
B.Tasks
C.External Tables
D.Stored Procedures
E.Dynamic Tables
AnswersA, B

Streams provide a 'change table' that tracks DML changes made to a source table, including inserts, updates, and deletes. They record the current offset and allow consumers to read exactly what has changed since the last time the stream was consumed, making them the foundational component for incremental data loading.

Why this answer

Modern data pipelines in Snowflake rely on the synergy between Streams and Tasks to achieve efficient CDC. Streams provide the ability to track changes at the row level without manual versioning, while Tasks provide the scheduling and execution framework. Together, they allow for automated, incremental processing that reduces latency and optimizes resource consumption.

Exam trap

Candidates often confuse streams and tasks with stored procedures or third-party orchestrators like Airflow. They forget that Snowflake provides native continuous CDC processing components specifically through this pairing.

60
MCQhard

A data engineer is tuning a query that filters on a VARCHAR column `status` with values such as 'ACTIVE', 'INACTIVE', and 'PENDING'. The table is very large and the query currently performs a full table scan. The engineer wants to reduce the amount of data scanned by using a search optimization service. Which action should the engineer take?

A.Create a secondary index on the status column using the CREATE INDEX command.
B.Add a clustering key on the status column and expect the query to use clustering for pruning.
C.Create a materialized view on the status column and query the materialized view instead.
D.Enable the search optimization service on the table and specify the status column in the search optimization configuration.
AnswerD

The search optimization service creates a persistent data structure that allows Snowflake to quickly locate micro-partitions that contain specific values. By enabling it on the table and including the status column, the query can use the search optimization access path to avoid scanning the entire table. This is the intended use case for selective equality and IN filters on large tables, and it directly reduces the data scanned.

Why this answer

The search optimization service is designed to accelerate selective point lookups and substring searches on large tables. Enabling it on the table and adding the status column to its configuration allows Snowflake to use an optimized access path that avoids a full table scan, directly addressing the performance issue.

Exam trap

The trap here is assuming that clustering or a materialized view is the best solution for highly selective point lookups, when the search optimization service is specifically built for that purpose.

61
MCQmedium

When a virtual warehouse spills data to local disk, what does this indicate about the query and resource allocation?

A.The warehouse is too large.
B.The memory capacity of the warehouse nodes is insufficient.
C.The data is not properly clustered.
D.The result cache is full.
AnswerB

When the memory allocated to a node is not enough to hold the intermediate results for complex operations like large joins or sorts, Snowflake must spill the data to local disk. This is a clear indicator that the compute resources (warehouse size) are not adequate for the query's demands.

Why this answer

Spilling to local disk occurs when the data required for an operation, such as a large join or sort, exceeds the memory capacity of the warehouse nodes. This significantly degrades performance because disk I/O is much slower than memory access. Recognizing this behavior is vital for performance tuning, as it signals that the current warehouse size is insufficient for the volume of data being processed, necessitating a larger warehouse or a more efficient query design.

Exam trap

Candidates often mistakenly believe that increasing the number of warehouse nodes (scaling out) will solve disk spilling. However, scaling out only helps with concurrency, not memory-intensive operations that require a larger node size.

62
MCQmedium

A data engineer runs a query that joins a large fact table to a small dimension table, but the Query Profile shows a Cartesian join instead of the intended inner join. The join predicate in the SQL is `ON fact.dim_id = dim.id`. Which action will most reliably correct the plan while preserving the query's result?

A.Increase the warehouse size from X-SMALL to LARGE to give the optimizer more compute resources.
B.Verify the data types of `fact.dim_id` and `dim.id` are compatible and add an explicit CAST so the join predicate uses matching types.
C.Rewrite the join as `ON fact.dim_id = dim.id AND fact.dim_id IS NOT NULL`.
D.Add the `USE_CACHED_RESULT = TRUE` parameter to the session before executing the query.
AnswerB

Snowflake may fail to recognize a join predicate when the two columns have incompatible or implicitly coercible types, leading the optimizer to fall back to a Cartesian join. Aligning data types with an explicit CAST restores an equality predicate the optimizer can use to build a hash join and preserve the intended result.

Why this answer

The optimizer can only build a hash join when it recognizes a valid equality predicate between compatible columns. If the join columns have mismatched or implicitly coercible data types, Snowflake may not recognize the predicate and may produce a Cartesian join. Explicitly aligning the data types with CAST restores the recognized equality, allowing the intended inner join and preserving the query's result.

Exam trap

The trap here is assuming that adding a null filter or increasing warehouse size can fix a Cartesian join, when the real cause is a join predicate the optimizer cannot recognize due to type mismatch.

63
Multi-Selecthard

Snowflake's optimizer uses various techniques to improve query performance dynamically. Which TWO of the following are examples of Adaptive Query Optimization?

Select 2 answers
A.Static partition pruning based on metadata
B.Dynamic Pruning
C.Join Filtering (Bloom Filters)
D.Manual Clustering Key assignment
E.Automatic Micro-partitioning
AnswersB, C

Dynamic pruning occurs during query execution, specifically in join operations. When one side of a join (the build side) is processed, Snowflake uses the resulting values to prune micro-partitions from the other side (the probe side) in real-time, significantly reducing the amount of data scanned.

Why this answer

Adaptive Query Optimization refers to the engine's ability to adjust its execution plan based on real-time data characteristics observed during query processing. This includes techniques like dynamic pruning and join filtering, which allow the engine to bypass irrelevant data even when static metadata is insufficient.

Exam trap

Candidates often confuse static pruning via micro-partitions with dynamic optimization techniques, failing to recognize runtime adjustments like Bloom filters and dynamic pruning.

64
MCQmedium

A data engineer is working with a table that contains a VARIANT column storing arrays of JSON objects. The engineer needs to produce a report that lists each object's attributes in separate rows. Which Snowflake function should the engineer use to transform the array into multiple rows?

A.FLATTEN
B.OBJECT_CONSTRUCT
C.PARSE_JSON
D.ARRAY_AGG
AnswerA

FLATTEN is a table function that takes a VARIANT column containing an array or object and returns a row for each element in the array or each key-value pair in the object. This is exactly what is needed to transform an array of objects into multiple rows, enabling further relational processing. It is the standard tool for exploding semi-structured data.

Why this answer

The FLATTEN function is specifically designed to explode semi-structured arrays and objects into multiple rows. When applied to a VARIANT column containing an array of objects, it returns one row per object, allowing the engineer to access each object's attributes. This is the correct approach for transforming nested data into a relational format for reporting.

Other functions either create semi-structured data or aggregate rows, which are not appropriate here.

Exam trap

The trap here is confusing functions that create or aggregate semi-structured data with those that explode it, leading to incorrect transformations.

65
MCQhard

A data engineer is tuning a query that joins a 900 million row fact table to a 2 million row dimension table. The dimension table is fully contained in the fact table's join-key range, and the join key is not the clustering key of either table. The engineer wants to eliminate the shuffle of the fact table across warehouse nodes. Which approach best achieves this?

A.Force the optimizer to broadcast the fact table to every node so each node joins locally.
B.Increase the warehouse size so the extra nodes provide enough memory to hold both tables without spilling.
C.Broadcast the 2 million row dimension table so each node joins its local fact table partitions.
D.Add a clustering key on the fact table's join column so the optimizer can use partition pruning during the join.
AnswerC

Broadcasting the smaller relation avoids redistributing the large fact table. Each node receives a full copy of the dimension table and joins it against whatever fact rows it already holds locally, which removes the expensive shuffle of 900 million rows. This is the standard strategy when one side of the join is small enough to fit in memory on every node.

Why this answer

The goal is to avoid moving the large relation. Broadcasting the small dimension table replicates only 2 million rows to each node, while every node keeps its local slice of the fact table and performs the join in place. This is the classic broadcast join pattern and is what the optimizer chooses automatically when one side is small.

Clustering, warehouse resizing, and broadcasting the large table all fail to remove the fact table shuffle.

Exam trap

The trap here is assuming that adding clustering or enlarging the warehouse changes the join distribution strategy, when only broadcasting the small relation removes the shuffle of the large relation.

Ready to test yourself?

Try a timed practice session using only Performance Optimization, Querying, and Transformation questions.