Skip to content
Docs

Spot a slow zone yourself

Use the daily segment times to watch a slow zone begin, with the same rules the site uses, in one SQL query.

The subway slow zones table is built from subway segment times with a few simple rules. Here we apply them by hand to one segment, so you can test the rules or try your own.

The segment: the E train southbound from Jackson Heights-Roosevelt Av (G14S) to Queens Plaza (G21S), in spring 2023.

ATTACH 'https://data.transitlab.nyc/v1/transitlab.duckdb' AS transitlab (READ_ONLY);
WITH daily AS (
SELECT service_date, mean_seconds, n_trips
FROM transitlab.subway_segment_times
WHERE a_stop = 'G14S' AND b_stop = 'G21S'
),
scored AS (
SELECT *,
-- A good typical day: the 10th percentile of the previous 120 weekdays
quantile_cont(mean_seconds, 0.10) OVER (
ORDER BY service_date ROWS BETWEEN 120 PRECEDING AND 1 PRECEDING
) AS baseline
FROM daily
)
SELECT service_date,
round(mean_seconds) AS seconds,
round(baseline) AS baseline,
mean_seconds >= baseline * 1.10 AND mean_seconds >= baseline + 10 AND n_trips >= 20 AS slow
FROM scored
WHERE service_date BETWEEN '2023-04-10' AND '2023-05-05'
ORDER BY service_date;
service_datesecondsbaselineslow
2023-04-20373355false
2023-04-21375355false
2023-04-24393355true
2023-04-25435355true
2023-04-26395355true
2023-04-27423355true

From Monday, April 24, trains took 40 to 80 seconds more over this stretch, day after day. Four slow weekdays in a row make a slow zone, so this one starts on the 24th. It ran until July 20 and cost riders more time than any other since 2022.

Trains were already a little slower the week before (373 to 381 seconds) but under the 10% line. Thresholds always trade early warnings against false alarms; change 1.10 and 10 to see how the start date moves.

Pick a row from transitlab.subway_slow_zones and put its a_stop and b_stop into the query, with dates around its start_date. Stop IDs end in N or S for the direction.

A median baseline would rise with every slow spell and slowly hide it. The 10th percentile tracks a good day, which moves only when something lasts for months, like a new timetable. The method has the full rules, including how disruptions and service changes are told apart.