SnowPro Core Certification Exam Questions and Answers
Question 181
What is the benefit of using the STRIP_OUTER_ARRAY parameter with the COPY INTO
command when loading data from a JSON file into a table?
Options:
A.
It flattens multiple arrays into a single array.
B.
It removes the outer array structure and loads separate rows of data
C.
It transforms a pivoted table into an array.
D.
It tokenizes each data string using the defined delimiters.
Answer:
B
Explanation:
The STRIP_OUTER_ARRAY parameter in the COPY INTO
command is used when loading data from a JSON file into a table. This parameter removes the outer array structure from the JSON data and loads separate rows of data into the table.
Understanding the STRIP_OUTER_ARRAY Parameter:
JSON files often contain data in an array format where multiple records are nested within a single outer array.
The STRIP_OUTER_ARRAY parameter helps in simplifying the loading process by removing this outer array, allowing each element within the array to be loaded as a separate row in the target table.
How It Works:
When the STRIP_OUTER_ARRAY parameter is set to TRUE, Snowflake treats each item within the outer array as an individual record.
This eliminates the need for additional parsing or transformation steps that would otherwise be required to handle nested arrays.
In this example, the JSON file containing an array of objects is loaded into the table my_table.
Each object within the array is loaded as a separate row, without the outer array structure.
Benefits:
Simplifies data loading: By removing the outer array, the data is directly loaded into the table without additional manipulation.
Enhances performance: Streamlines the loading process, reducing the complexity and potential errors in handling nested JSON structures.
References:
Snowflake Documentation: COPY INTO
Snowflake Documentation: JSON File Format Options
Question 182
A Snowflake user wants to optimize performance for a query that queries only a small number of rows in a table. The rows require significant processing. The data in the table does not change frequently.
What should the user do?
Options:
A.
Add a clustering key to the table.
B.
Add the search optimization service to the table.
C.
Create a materialized view based on the query.
D.
Enable the query acceleration service for the virtual warehouse.
Answer:
C
Explanation:
In a scenario where a Snowflake user queries only a small number of rows that require significant processing and the data in the table does not change frequently, the most effective way to optimize performance is by creating a materialized view based on the query. Materialized views store the result of the query and can significantly reduce the computation time for queries that are executed frequently over unchanged data.
Why Materialized Views: Materialized views precompute and store the result of the query. This is especially beneficial for queries that require heavy processing. Since the data does not change frequently, the materialized view will not need to be refreshed often, making it an ideal solution for this use case.
Implementation Steps:
To create a materialized view, use the following SQL command:
CREATE MATERIALIZED VIEW my_materialized_view AS SELECT ... FROM my_table WHERE ...;
When the query is run, Snowflake uses the precomputed results from the materialized view, thus skipping the need for recalculating the data and improving query performance.
[Reference: For more information on materialized views and how they can be used to optimize query performance, refer to the Snowflake documentation on materialized views: https://docs.snowflake.com/en/user-guide/views-materialized.html, , ]
Question 183
Which database objects can be shared with Secure Data Sharing? (Select TWO).
Options:
A.
Views
B.
Materialized views
C.
External stages
D.
External tables
E.
Dynamic tables
Answer:
A, E
Explanation:
Secure Data Sharing allows sharing the following objects:
Views (A): Logical objects that allow controlled data sharing without exposing the underlying tables.
Dynamic tables (E): Can be shared to provide real-time data access while maintaining security.
Other Notes:
Materialized views (B): Cannot be directly shared.
External stages (C): Cannot be shared through Secure Data Sharing.
External tables (D): Data remains outside Snowflake and cannot be shared directly.
References:
Snowflake Documentation: Secure Data Sharing
Objects Supported for Sharing
Question 184
Which Snowflake feature or tool helps troubleshoot issues in SQL query expressions that commonly cause performance bottlenecks?
Options:
A.
Persisted query results
B.
QUERY_HISTORY View
C.
Query acceleration service
D.
Query Profile
Answer:
D
Explanation:
The Snowflake feature that helps troubleshoot issues in SQL query expressions and commonly identify performance bottlenecks is the Query Profile. The Query Profile provides a detailed breakdown of a query's execution plan, including each operation's time and resources consumed. It visualizes the steps involved in the query execution, highlighting areas that may be causing inefficiencies, such as full table scans, large joins, or operations that could benefit from optimization.
By examining the Query Profile, developers and database administrators can identify and troubleshoot performance issues, optimize query structures, and make informed decisions about potential schema or indexing changes to improve performance.
References:
Snowflake Documentation on Query Profile: Using the Query Profile