What would you do if your query takes too long as there many rows of data
For this SQL exercise, write a PostgreSQL query that returns the requested metrics while demonstrating an approach suitable for large tables.
month, seller_id, completed_orders, gmv, and previous_month_gmv.seller_id, then month ascending. Rows with a NULL previous_month_gmv are retained because they represent a seller's first available month.| Column | Type | Description |
|---|---|---|
| seller_idPK | INT | Seller identifier |
| seller_name | VARCHAR(100) | Seller display name |
| is_active | BOOLEAN | Whether the seller is active |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Order identifier |
| seller_id | INT | Seller responsible for the order |
| order_date | DATE | Order creation date |
| status | VARCHAR(30) | Current order status |
| Column | Type | Description |
|---|---|---|
| order_item_idPK | INT | Order item identifier |
| order_id | INT | Related order identifier |
| unit_price | NUMERIC(12,2) | Price of one item |
| quantity | INT | Quantity purchased |