Your question is Optimizing Slow JSON Processing. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
How do you optimize a script that is performing slowly on a large JSON dataset?
Write a PostgreSQL query that reports completed events from production batches in the requested date range. Extract only the required JSON attributes and exclude batches outside the range or from other source systems.
batch_date, action, event_count, and avg_duration_ms.batch_date, then action.| Column | Type | Description |
|---|---|---|
| batch_idPK | INT | Unique identifier for an ingestion batch |
| batch_date | DATE | Date associated with the batch |
| source_system | VARCHAR(50) | System that produced the batch |
| Column | Type | Description |
|---|---|---|
| record_idPK | INT | Unique identifier for an event record |
| batch_id | INT | Batch containing the event record |
| payload | VARCHAR(2000) | JSON event payload stored as text |