A reporting query at a commerce platform summarizes recent orders for active customers, but the production version is slow. Write a PostgreSQL query that returns the top active customers by order revenue since January 1, 2024, while also providing an execution plan that can be inspected for scans, joins, aggregation, sorting, and buffer usage.
Output
- Return the PostgreSQL execution plan for the query.
- The underlying result contains one row per active customer with orders on or after January 1, 2024, including
customer_id, order_count, and total_amount.
- Sort customers by
total_amount descending and return at most 10 customers.