How would you approach optimizing a slow-running SQL query?
Using the supplied PostgreSQL tables, demonstrate your approach with a query that returns completed order totals for customers during January 2025. Keep the response focused on query structure, filtering, join behavior, and performance considerations.
customer_id, customer_name, total_completed_amount.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| customer_id | INT | Customer associated with the order |
| status | VARCHAR(20) | Order processing status |
| order_date | DATE | Date the order was placed |
| amount | DECIMAL(10,2) | Order amount |