How do you optimize query performance in a distributed data environment?
Using the provided tables, write a PostgreSQL query that returns active datasets with at least one failed pipeline run during January 2025.
dataset_name, region, failed_runs, and max_duration_secondsfailed_runs descending, then dataset_name ascending| Column | Type | Description |
|---|---|---|
| dataset_idPK | INT | Unique dataset identifier |
| dataset_name | VARCHAR(100) | Dataset name |
| region | VARCHAR(40) | Deployment region |
| owner_team | VARCHAR(80) | Owning engineering team |
| is_active | BOOLEAN | Whether the dataset is active |
| Column | Type | Description |
|---|---|---|
| run_idPK | INT | Unique pipeline run identifier |
| dataset_id | INT | Dataset processed by the run |
| status | VARCHAR(20) | Pipeline run status |
| started_at | TIMESTAMP | Pipeline start timestamp |
| duration_seconds | INT | Run duration in seconds |