
Answer-first summary for fast verification
Answer: Flatten the data and store it in structured data types in a flattened table. Query the table.
The question focuses on achieving optimal query performance for JSON data containing numerous dates and arrays. According to Snowflake documentation and the community discussion, when semi-structured data includes dates/timestamps and arrays, flattening the data into structured relational columns (Option A) provides better pruning and storage efficiency. This approach allows Snowflake to leverage micro-partition clustering and native data type optimizations for dates, which are stored as strings in VARIANT columns, leading to improved query performance. Option B (storing in VARIANT) is flexible but less performant for this specific data pattern. Option C (VARIANT with STRIP_NULL_VALUES) does not address the core performance issues with dates and arrays. Option D (external stage with views) introduces unnecessary complexity without performance benefits. The community consensus, supported by upvoted comments and Snowflake's recommendations, strongly favors Option A for optimal performance in this scenario.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
How can optimal query performance be achieved when processing a JSON file containing numerous dates and arrays in Snowflake?
A
Flatten the data and store it in structured data types in a flattened table. Query the table.
B
Store the data in a table with a VARIANT data type. Query the table.
C
Store the data in a table with a VARIANT data type and include STRIP_NULL_VALUES while loading the table. Query the table.
D
Store the data in an external stage and create views on top of it. Query the views.