How do you optimize a query that is performing poorly on a large dataset in Citi environments?
You are given a query that returns slow results on a large transactional dataset. Improve it so it returns the same answer with better performance.
| Column | Type | Description |
|---|---|---|
| transaction_idPK | BIGINT | Unique transaction identifier |
| account_id | BIGINT | Account associated with the transaction |
| transaction_date | DATE | Date the transaction was posted |
| amount | NUMERIC(12,2) | Transaction amount |
| status | VARCHAR(20) | Transaction status |
| Column | Type | Description |
|---|---|---|
| account_idPK | BIGINT | Unique account identifier |
| region_name | VARCHAR(50) | Account region |
| is_active | BOOLEAN | Whether the account is active |