QUESTION 41
A data analyst is tasked with optimizing a query that aggregates data from a table ‘ORDERS’ containing order details, including columns like ‘ORDER ID’, ‘CUSTOMER ID, ‘ORDER DATE, ‘PRODUCT ID’, and ‘QUANTITY. The query calculates the total quantity of products ordered per customer and month. The current query is as follows: SELECT CUSTOMER ID, DATE TRUNC(‘MONTH’, ORDER DATE) AS ORDER MONTH, SUM(QUANTITY) AS TOTAL QUANTITY FROM ORDERS GROUP BY CUSTOMER_ID, ORDER_MONTH ORDER BY CljSTOMER_lD, ORDER_MONTH; Deopite the ‘ORDERS’ table being relatively small (10 million rows), the query performance is slow. The analyst suspects a poorly chosen warehouse size. Which of the following actions, combined with monitoring query execution, would be MOST beneficial to determine the optimal warehouse size and improve query performance?
The most beneficial approach is to start with the smallest warehouse size and incrementally increase it (B). This allows for observing the impact of warehouse size on query performance and cloud services usage. Increasing until the query time plateaus or cloud services usage increases significantly indicates the point of diminishing returns. Simply using the largest size (A) may be wasteful, and ignoring cloud services usage (C) can lead to cost overruns. Query history (D) may not be relevant if the query is significantly different. Setting a timeout (E) will not optimize the warehouse size.