Walk me through how you would optimize a join between two massive tables.
Use the provided Waymo-style segment and vehicle event tables. Return daily segment rows for January 2026, including segments without qualifying events. Exclude events with a NULL segment identifier from the event results.
segment_id, segment_date, region, speed_limit, event_count, and total_duration.segment_date, then segment_id ascending.| Column | Type | Description |
|---|---|---|
| segment_idPK | INT | Unique route segment identifier |
| segment_date | DATE | Date associated with the route segment |
| region | VARCHAR(50) | Operational region containing the segment |
| speed_limit | NUMERIC(5,2) | Posted speed limit for the segment |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique vehicle event identifier |
| segment_id | INT | Route segment associated with the event |
| event_date | DATE | Date on which the event occurred |
| event_type | VARCHAR(50) | Vehicle software event category |
| duration_seconds | NUMERIC(10,2) | Event duration in seconds |