Complete the code to select data from a table using the most cost-effective warehouse.
USE WAREHOUSE [1]; SELECT * FROM sales_data WHERE region = 'US';
Using a smaller warehouse like SMALL_WH reduces compute costs while still processing the query efficiently.
Complete the code to create a clustered table to optimize query performance and cost.
CREATE TABLE orders_clustered CLUSTER BY ([1]) AS SELECT * FROM orders;Clustering by order_date helps queries filter by date efficiently, reducing compute time and cost.
Fix the error in the query that causes unnecessary compute cost by avoiding a full table scan.
SELECT * FROM customers WHERE [1] = 'NY';
Filtering by state_code uses the clustered column to reduce scanned data and cost.
Fill both blanks to create a materialized view that reduces compute costs for frequent queries.
CREATE MATERIALIZED VIEW recent_orders AS SELECT * FROM orders WHERE order_date [1] CURRENT_DATE - INTERVAL '[2]' DAY;
Using order_date > CURRENT_DATE - INTERVAL '30' DAY creates a view of recent orders, speeding up queries and saving costs.
Fill all three blanks to optimize a query by selecting only necessary columns and filtering efficiently.
SELECT [1], [2] FROM sales WHERE region = '[3]';
Selecting only product_id and sales_amount for region US reduces data scanned and lowers costs.