Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用PostgreSQL中的GTFS数据快速查找中转站之间的行程时间_Sql_Postgresql_Query Optimization_Gtfs - Fatal编程技术网

如何使用PostgreSQL中的GTFS数据快速查找中转站之间的行程时间

如何使用PostgreSQL中的GTFS数据快速查找中转站之间的行程时间,sql,postgresql,query-optimization,gtfs,Sql,Postgresql,Query Optimization,Gtfs,我有一个PostgreSQL数据库(带有PostGIS)和几个运输机构导入的GTFS数据()。我已经根据距离确定了所有可能的转移地点,并用这些数据填充了一个表。我现在想找出该地区允许最多2次换乘的点之间的旅行时间。我创建了一个连接所有表的视图,以使我的查询更易于读取旅行时间。以下是我的看法: CREATE OR REPLACE VIEW trip_planning_data_view AS SELECT b.agency_id, i.agency_name, h.route_id, h.ro

我有一个PostgreSQL数据库(带有PostGIS)和几个运输机构导入的GTFS数据()。我已经根据距离确定了所有可能的转移地点,并用这些数据填充了一个表。我现在想找出该地区允许最多2次换乘的点之间的旅行时间。我创建了一个连接所有表的视图,以使我的查询更易于读取旅行时间。以下是我的看法:

CREATE OR REPLACE VIEW trip_planning_data_view AS 
 SELECT b.agency_id, i.agency_name, h.route_id, h.route_long_name, h.route_short_name, h.route_type, 
    e.trip_headsign, e.direction_id, a.stop_id AS stop_id_a, c.stop_name AS origin_stop_name, a.arrival_time AS origin_arrival_time, 
    b.stop_id AS stop_id_b, d.stop_name AS destination_stop_name, b.arrival_time AS destination_arrival_time, 
    b.arrival_time - a.arrival_time AS travel_time, 
    g.agency_id_b AS transfer_agency_id, g.stop_id_b AS transfer_stop_id, g.distance_meters AS transfer_distance_meters, 
    (round(g.distance_meters / 60::double precision)::character varying || ' Minutes'::character varying)::interval AS transfer_time, 
    b.arrival_time + ((round(g.distance_meters / 60::double precision)::character varying || ' Minutes'::character varying)::interval) AS transfer_arrival_time
   FROM stop_time a
   JOIN stop_time b ON a.agency_id = b.agency_id AND a.trip_id = b.trip_id AND a.stop_id <> b.stop_id AND a.stop_sequence < b.stop_sequence AND a.arrival_time < b.arrival_time
   JOIN stop c ON a.agency_id = c.agency_id AND a.stop_id = c.stop_id
   JOIN stop d ON b.agency_id = d.agency_id AND b.stop_id = d.stop_id
   JOIN trip e ON a.agency_id = e.agency_id AND a.trip_id = e.trip_id
   JOIN calendar f ON e.agency_id = f.agency_id AND e.service_id = f.service_id
   LEFT JOIN stop_transfers g ON b.agency_id = g.agency_id_a AND b.stop_id = g.stop_id_a
   JOIN route h ON e.agency_id = h.agency_id AND e.route_id = h.route_id
   JOIN agency i ON h.agency_id = i.agency_id
  WHERE f.monday = true
  ORDER BY a.stop_id, b.arrival_time - a.arrival_time;
以下是查询计划:

Nested Loop  (cost=168984.47..203333.30 rows=1 width=651)
  ->  Nested Loop  (cost=168984.47..203324.90 rows=1 width=686)
        Join Filter: (((g.stop_id_b)::text = (a.stop_id)::text) AND (a.arrival_time >= ((a.arrival_time + (b.arrival_time - a.arrival_time)) + ((((round((g.distance_meters / 60::double precision)))::character varying)::text || ' Minutes'::text))::interval)) AND (a.arrival_time <= (((a.arrival_time + '00:30:00'::interval) + (b.arrival_time - a.arrival_time)) + ((((round((g.distance_meters / 60::double precision)))::character varying)::text || ' Minutes'::text))::interval)))
        ->  Nested Loop  (cost=0.00..117.22 rows=1 width=252)
              Join Filter: ((a.agency_id)::text = (h.agency_id)::text)
              ->  Nested Loop  (cost=0.00..108.94 rows=1 width=216)
                    ->  Nested Loop  (cost=0.00..100.65 rows=1 width=220)
                          Join Filter: ((a.agency_id)::text = (e.agency_id)::text)
                          ->  Nested Loop  (cost=0.00..91.92 rows=1 width=198)
                                ->  Nested Loop  (cost=0.00..83.50 rows=1 width=161)
                                      Join Filter: (((a.stop_id)::text <> (b.stop_id)::text) AND (a.stop_sequence < b.stop_sequence) AND (a.arrival_time < b.arrival_time))
                                      ->  Nested Loop Left Join  (cost=0.00..42.66 rows=1 width=112)
                                            ->  Nested Loop  (cost=0.00..34.29 rows=1 width=90)
                                                  ->  Index Scan using st_a_s_idx on stop_time b  (cost=0.00..25.88 rows=1 width=53)
                                                        Index Cond: (((agency_id)::text = '1A'::text) AND ((stop_id)::text = 's247'::text))
                                                  ->  Index Scan using a_stop_idx on stop d  (cost=0.00..8.40 rows=1 width=44)
                                                        Index Cond: (((agency_id)::text = (b.agency_id)::text) AND ((stop_id)::text = (b.stop_id)::text))
                                            ->  Index Scan using stop_transfers_as_a_idx on stop_transfers g  (cost=0.00..8.35 rows=1 width=36)
                                                  Index Cond: (((b.agency_id)::text = (agency_id_a)::text) AND ((b.stop_id)::text = (stop_id_a)::text))
                                      ->  Index Scan using st_a_t_idx on stop_time a  (cost=0.00..40.78 rows=3 width=53)
                                            Index Cond: (((agency_id)::text = (b.agency_id)::text) AND ((trip_id)::text = (b.trip_id)::text))
                                ->  Index Scan using a_stop_idx on stop c  (cost=0.00..8.40 rows=1 width=44)
                                      Index Cond: (((agency_id)::text = (a.agency_id)::text) AND ((stop_id)::text = (a.stop_id)::text))
                          ->  Index Scan using trip_id_idx on trip e  (cost=0.00..8.71 rows=1 width=80)
                                Index Cond: ((trip_id)::text = (a.trip_id)::text)
                    ->  Index Scan using a_s_idx on calendar f  (cost=0.00..8.28 rows=1 width=20)
                          Index Cond: (((agency_id)::text = (a.agency_id)::text) AND ((service_id)::text = (e.service_id)::text))
                          Filter: monday
              ->  Index Scan using route_id_idx on route h  (cost=0.00..8.27 rows=1 width=41)
                    Index Cond: ((route_id)::text = (e.route_id)::text)
        ->  Nested Loop  (cost=168984.47..203207.60 rows=1 width=434)
              ->  Nested Loop  (cost=168984.47..203199.32 rows=1 width=477)
                    ->  Nested Loop  (cost=168984.47..203191.04 rows=1 width=520)
                          Join Filter: (((g.agency_id_b)::text = (b.agency_id)::text) AND ((g.stop_id_b)::text = (a.stop_id)::text) AND (a.arrival_time >= ((a.arrival_time + (b.arrival_time - a.arrival_time)) + ((((round((g.distance_meters / 60::double precision)))::character varying)::text || ' Minutes'::text))::interval)) AND (a.arrival_time <= (((a.arrival_time + '00:30:00'::interval) + (b.arrival_time - a.arrival_time)) + ((((round((g.distance_meters / 60::double precision)))::character varying)::text || ' Minutes'::text))::interval)))
                          ->  Nested Loop  (cost=168933.50..178461.70 rows=1 width=260)
                                ->  Nested Loop  (cost=168933.50..178453.41 rows=1 width=264)
                                      ->  Nested Loop  (cost=168933.50..178444.99 rows=1 width=227)
                                            Join Filter: (((a.stop_id)::text <> (b.stop_id)::text) AND (a.stop_sequence < b.stop_sequence) AND (a.arrival_time < b.arrival_time))
                                            ->  Nested Loop  (cost=168933.50..178404.16 rows=1 width=236)
                                                  Join Filter: ((b.agency_id)::text = (h.agency_id)::text)
                                                  ->  Nested Loop  (cost=168933.50..178387.59 rows=2 width=200)
                                                        Join Filter: ((b.agency_id)::text = (e.agency_id)::text)
                                                        ->  Nested Loop  (cost=168933.50..177724.50 rows=76 width=120)
                                                              ->  Merge Join  (cost=168933.50..170942.05 rows=869 width=89)
                                                                    Merge Cond: (((b.agency_id)::text = (g.agency_id_a)::text) AND ((b.stop_id)::text = (g.stop_id_a)::text))
                                                                    ->  Sort  (cost=144224.83..144325.07 rows=40096 width=53)
                                                                          Sort Key: b.agency_id, b.stop_id
                                                                          ->  Bitmap Heap Scan on stop_time b  (cost=1068.60..141159.25 rows=40096 width=53)
                                                                                Recheck Cond: ((agency_id)::text = '1A'::text)
                                                                                ->  Bitmap Index Scan on st_a_s_idx  (cost=0.00..1058.58 rows=40096 width=0)
                                                                                      Index Cond: ((agency_id)::text = '1A'::text)
                                                                    ->  Sort  (cost=24708.45..25274.92 rows=226587 width=36)
                                                                          Sort Key: g.agency_id_a, g.stop_id_a
                                                                          ->  Seq Scan on stop_transfers g  (cost=0.00..4553.87 rows=226587 width=36)
                                                              ->  Index Scan using a_stop_idx on stop d  (cost=0.00..7.79 rows=1 width=44)
                                                                    Index Cond: (((agency_id)::text = (b.agency_id)::text) AND ((stop_id)::text = (b.stop_id)::text))
                                                        ->  Index Scan using trip_id_idx on trip e  (cost=0.00..8.71 rows=1 width=80)
                                                              Index Cond: ((trip_id)::text = (b.trip_id)::text)
                                                  ->  Index Scan using route_id_idx on route h  (cost=0.00..8.27 rows=1 width=41)
                                                        Index Cond: ((route_id)::text = (e.route_id)::text)
                                            ->  Index Scan using st_a_t_idx on stop_time a  (cost=0.00..40.80 rows=1 width=53)
                                                  Index Cond: (((agency_id)::text = (b.agency_id)::text) AND ((trip_id)::text = (b.trip_id)::text))
                                                  Filter: ((arrival_time >= '08:11:00'::interval) AND (arrival_time <= '08:30:00'::interval) AND ((stop_id)::text = 's101'::text))
                                      ->  Index Scan using a_stop_idx on stop c  (cost=0.00..8.40 rows=1 width=44)
                                            Index Cond: (((agency_id)::text = (a.agency_id)::text) AND ((stop_id)::text = (a.stop_id)::text))
                                ->  Index Scan using a_s_idx on calendar f  (cost=0.00..8.28 rows=1 width=20)
                                      Index Cond: (((agency_id)::text = (a.agency_id)::text) AND ((service_id)::text = (e.service_id)::text))
                                      Filter: monday
                          ->  Nested Loop  (cost=50.97..24729.27 rows=1 width=260)
                                ->  Nested Loop  (cost=50.97..24720.85 rows=1 width=223)
                                      Join Filter: (((a.stop_id)::text <> (b.stop_id)::text) AND (a.stop_sequence < b.stop_sequence) AND (a.arrival_time < b.arrival_time))
                                      ->  Nested Loop  (cost=50.97..24680.01 rows=1 width=232)
                                            ->  Nested Loop  (cost=50.97..24663.42 rows=2 width=236)
                                                  Join Filter: ((b.agency_id)::text = (h.agency_id)::text)
                                                  ->  Nested Loop  (cost=50.97..24447.16 rows=29 width=200)
                                                        Join Filter: ((b.agency_id)::text = (e.agency_id)::text)
                                                        ->  Nested Loop  (cost=50.97..15148.58 rows=1096 width=120)
                                                              ->  Nested Loop  (cost=50.97..12475.29 rows=59 width=80)
                                                                    ->  Bitmap Heap Scan on stop_transfers g  (cost=50.97..2141.81 rows=1375 width=36)
                                                                          Recheck Cond: ((agency_id_b)::text = '1A'::text)
                                                                          ->  Bitmap Index Scan on stop_transfers_as_b_idx  (cost=0.00..50.63 rows=1375 width=0)
                                                                                Index Cond: ((agency_id_b)::text = '1A'::text)
                                                                    ->  Index Scan using a_stop_idx on stop d  (cost=0.00..7.50 rows=1 width=44)
                                                                          Index Cond: (((agency_id)::text = (g.agency_id_a)::text) AND ((stop_id)::text = (g.stop_id_a)::text))
                                                              ->  Index Scan using st_a_s_idx on stop_time b  (cost=0.00..45.22 rows=6 width=53)
                                                                    Index Cond: (((agency_id)::text = (d.agency_id)::text) AND ((stop_id)::text = (d.stop_id)::text))
                                                        ->  Index Scan using trip_id_idx on trip e  (cost=0.00..8.47 rows=1 width=80)
                                                              Index Cond: ((trip_id)::text = (b.trip_id)::text)
                                                  ->  Index Scan using route_id_idx on route h  (cost=0.00..7.44 rows=1 width=41)
                                                        Index Cond: ((route_id)::text = (e.route_id)::text)
                                            ->  Index Scan using a_s_idx on calendar f  (cost=0.00..8.28 rows=1 width=20)
                                                  Index Cond: (((agency_id)::text = (b.agency_id)::text) AND ((service_id)::text = (e.service_id)::text))
                                                  Filter: monday
                                      ->  Index Scan using st_a_t_idx on stop_time a  (cost=0.00..40.78 rows=3 width=53)
                                            Index Cond: (((agency_id)::text = (b.agency_id)::text) AND ((trip_id)::text = (b.trip_id)::text))
                                ->  Index Scan using a_stop_idx on stop c  (cost=0.00..8.40 rows=1 width=44)
                                      Index Cond: (((agency_id)::text = (a.agency_id)::text) AND ((stop_id)::text = (a.stop_id)::text))
                    ->  Index Scan using agency_id_idx on agency i  (cost=0.00..8.27 rows=1 width=31)
                          Index Cond: ((agency_id)::text = (a.agency_id)::text)
              ->  Index Scan using agency_id_idx on agency i  (cost=0.00..8.27 rows=1 width=31)
                    Index Cond: ((agency_id)::text = (a.agency_id)::text)
  ->  Index Scan using agency_id_idx on agency i  (cost=0.00..8.27 rows=1 width=31)
        Index Cond: ((agency_id)::text = (a.agency_id)::text)
嵌套循环(成本=168984.47..203333.30行=1宽度=651)
->嵌套循环(成本=168984.47..203324.90行=1宽度=686)
连接筛选器:((g.stop_id_b)::text=(a.stop_id)::text)和(a.arrival_time>=((a.arrival_time+(b.arrival_time-a.arrival_time-a.arrival_time))+(((round((g.distance_meters/60::double precision))::字符变化)::text |“分钟”::text))::间隔)和(a.arrival_时间嵌套循环(成本=0.00..117.22行=1宽度=252)
加入筛选器:((a.agency\u id)::text=(h.agency\u id)::text)
->嵌套循环(成本=0.00..108.94行=1宽度=216)
->嵌套循环(成本=0.00..100.65行=1宽度=220)
加入筛选器:((a.agency\u id)::text=(e.agency\u id)::text)
->嵌套循环(成本=0.00..91.92行=1宽度=198)
->嵌套循环(成本=0.00..83.50行=1宽度=161)
联接筛选器:((a.stop\u id)::text(b.stop\u id)::text)和(a.stop\u序列嵌套循环左连接(成本=0.00..42.66行=1宽度=112)
->嵌套循环(成本=0.00..34.29行=1宽度=90)
->在停止时间b上使用st_a_s_idx进行索引扫描(成本=0.00..25.88行=1宽度=53)
索引条件:((代理id::text='1A'::text)和((停止id::text='s247'::text))
->在stop d上使用_stop_idx进行索引扫描(成本=0.00..8.40行=1宽度=44)
索引条件:((代理id::text=(b.代理id::text)和((停止id::text=(b.停止id::text))
->在停止传输g上使用停止传输作为idx进行索引扫描(成本=0.00..8.35行=1宽度=36)
索引条件:((b.代理id::text=(代理id::text)和((b.停止id::text=(停止id::text))
->在停止时间a上使用st_a_t_idx进行索引扫描(成本=0.00..40.78行=3宽度=53)
索引条件:((机构id::text=(b.机构id::text)和((行程id::text=(b.行程id::text))
->在stop c上使用_stop_idx进行索引扫描(成本=0.00..8.40行=1宽度=44)
索引条件:((代理id::text=(a.代理id::text)和((停止id::text=(a.停止id::text))
->在行程e上使用行程id进行索引扫描(成本=0.00..8.71行=1宽度=80)
索引条件:((trip\u id)::text=(a.trip\u id)::text)
->在日历f上使用_s_idx进行索引扫描(成本=0.00..8.28行=1宽度=20)
索引条件:((机构id::text=(a.机构id::text)和((服务id::text=(e.服务id::text))
过滤器:星期一
->使用路由h上的路由id索引扫描(成本=0.00..8.27行=1宽度=41)
索引条件:((路由id)::text=(e.route\u id)::text)
->嵌套循环(成本=168984.47..203207.60行=1宽度=434)
->嵌套循环(成本=168984.47..203199.32行=1宽度=477)
->嵌套循环(成本=168984.47..203191.04行=1宽度=520)
连接筛选器:((g.agency_id_b)::text=(b.agency_id)::text)和((g.stop_id_b)::text=(a.stop_id::text)和(a.arrival_time>=((a.arrival_time+(b.arrival_time-a.arrival_time))+(((圆形((g.distance_meters/60::双精度))::字符变化)::text | |‘分钟’::text))::间隔)和(a.arrival|(成本=168933.50..178461.70行=1宽=260)
->嵌套循环(成本=168933.50..178453.41行=1宽度=264)
->嵌套循环(成本=168933.50..178444.99行=1宽度=227)
联接筛选器:((a.stop\u id)::text(b.stop\u id)::text)和(a.stop\u序列嵌套循环(成本=168933.50..178404.16行=1宽度=236)
加入筛选器:((b.agency\u id)::text=(h.agency\u id)::text)
->嵌套循环(成本=168933.50..178387.59行=2宽度=200)
加入筛选器:((b.agency\u id)::text=(e.agency\u id)::text)
->嵌套循环(成本=168933.50..177724.50行=76宽度=120)
->合并联接(成本=168933.50..170942.05行=869宽度=89)
合并条件:((b.代理id::text=(g.代理id::text)和((b.停止id::text=(g.停止id::text))
->排序(成本=144224.83..144325.07行=40096宽度=53)
排序键:b.机构id,b.停止id
->B
Nested Loop  (cost=168984.47..203333.30 rows=1 width=651)
  ->  Nested Loop  (cost=168984.47..203324.90 rows=1 width=686)
        Join Filter: (((g.stop_id_b)::text = (a.stop_id)::text) AND (a.arrival_time >= ((a.arrival_time + (b.arrival_time - a.arrival_time)) + ((((round((g.distance_meters / 60::double precision)))::character varying)::text || ' Minutes'::text))::interval)) AND (a.arrival_time <= (((a.arrival_time + '00:30:00'::interval) + (b.arrival_time - a.arrival_time)) + ((((round((g.distance_meters / 60::double precision)))::character varying)::text || ' Minutes'::text))::interval)))
        ->  Nested Loop  (cost=0.00..117.22 rows=1 width=252)
              Join Filter: ((a.agency_id)::text = (h.agency_id)::text)
              ->  Nested Loop  (cost=0.00..108.94 rows=1 width=216)
                    ->  Nested Loop  (cost=0.00..100.65 rows=1 width=220)
                          Join Filter: ((a.agency_id)::text = (e.agency_id)::text)
                          ->  Nested Loop  (cost=0.00..91.92 rows=1 width=198)
                                ->  Nested Loop  (cost=0.00..83.50 rows=1 width=161)
                                      Join Filter: (((a.stop_id)::text <> (b.stop_id)::text) AND (a.stop_sequence < b.stop_sequence) AND (a.arrival_time < b.arrival_time))
                                      ->  Nested Loop Left Join  (cost=0.00..42.66 rows=1 width=112)
                                            ->  Nested Loop  (cost=0.00..34.29 rows=1 width=90)
                                                  ->  Index Scan using st_a_s_idx on stop_time b  (cost=0.00..25.88 rows=1 width=53)
                                                        Index Cond: (((agency_id)::text = '1A'::text) AND ((stop_id)::text = 's247'::text))
                                                  ->  Index Scan using a_stop_idx on stop d  (cost=0.00..8.40 rows=1 width=44)
                                                        Index Cond: (((agency_id)::text = (b.agency_id)::text) AND ((stop_id)::text = (b.stop_id)::text))
                                            ->  Index Scan using stop_transfers_as_a_idx on stop_transfers g  (cost=0.00..8.35 rows=1 width=36)
                                                  Index Cond: (((b.agency_id)::text = (agency_id_a)::text) AND ((b.stop_id)::text = (stop_id_a)::text))
                                      ->  Index Scan using st_a_t_idx on stop_time a  (cost=0.00..40.78 rows=3 width=53)
                                            Index Cond: (((agency_id)::text = (b.agency_id)::text) AND ((trip_id)::text = (b.trip_id)::text))
                                ->  Index Scan using a_stop_idx on stop c  (cost=0.00..8.40 rows=1 width=44)
                                      Index Cond: (((agency_id)::text = (a.agency_id)::text) AND ((stop_id)::text = (a.stop_id)::text))
                          ->  Index Scan using trip_id_idx on trip e  (cost=0.00..8.71 rows=1 width=80)
                                Index Cond: ((trip_id)::text = (a.trip_id)::text)
                    ->  Index Scan using a_s_idx on calendar f  (cost=0.00..8.28 rows=1 width=20)
                          Index Cond: (((agency_id)::text = (a.agency_id)::text) AND ((service_id)::text = (e.service_id)::text))
                          Filter: monday
              ->  Index Scan using route_id_idx on route h  (cost=0.00..8.27 rows=1 width=41)
                    Index Cond: ((route_id)::text = (e.route_id)::text)
        ->  Nested Loop  (cost=168984.47..203207.60 rows=1 width=434)
              ->  Nested Loop  (cost=168984.47..203199.32 rows=1 width=477)
                    ->  Nested Loop  (cost=168984.47..203191.04 rows=1 width=520)
                          Join Filter: (((g.agency_id_b)::text = (b.agency_id)::text) AND ((g.stop_id_b)::text = (a.stop_id)::text) AND (a.arrival_time >= ((a.arrival_time + (b.arrival_time - a.arrival_time)) + ((((round((g.distance_meters / 60::double precision)))::character varying)::text || ' Minutes'::text))::interval)) AND (a.arrival_time <= (((a.arrival_time + '00:30:00'::interval) + (b.arrival_time - a.arrival_time)) + ((((round((g.distance_meters / 60::double precision)))::character varying)::text || ' Minutes'::text))::interval)))
                          ->  Nested Loop  (cost=168933.50..178461.70 rows=1 width=260)
                                ->  Nested Loop  (cost=168933.50..178453.41 rows=1 width=264)
                                      ->  Nested Loop  (cost=168933.50..178444.99 rows=1 width=227)
                                            Join Filter: (((a.stop_id)::text <> (b.stop_id)::text) AND (a.stop_sequence < b.stop_sequence) AND (a.arrival_time < b.arrival_time))
                                            ->  Nested Loop  (cost=168933.50..178404.16 rows=1 width=236)
                                                  Join Filter: ((b.agency_id)::text = (h.agency_id)::text)
                                                  ->  Nested Loop  (cost=168933.50..178387.59 rows=2 width=200)
                                                        Join Filter: ((b.agency_id)::text = (e.agency_id)::text)
                                                        ->  Nested Loop  (cost=168933.50..177724.50 rows=76 width=120)
                                                              ->  Merge Join  (cost=168933.50..170942.05 rows=869 width=89)
                                                                    Merge Cond: (((b.agency_id)::text = (g.agency_id_a)::text) AND ((b.stop_id)::text = (g.stop_id_a)::text))
                                                                    ->  Sort  (cost=144224.83..144325.07 rows=40096 width=53)
                                                                          Sort Key: b.agency_id, b.stop_id
                                                                          ->  Bitmap Heap Scan on stop_time b  (cost=1068.60..141159.25 rows=40096 width=53)
                                                                                Recheck Cond: ((agency_id)::text = '1A'::text)
                                                                                ->  Bitmap Index Scan on st_a_s_idx  (cost=0.00..1058.58 rows=40096 width=0)
                                                                                      Index Cond: ((agency_id)::text = '1A'::text)
                                                                    ->  Sort  (cost=24708.45..25274.92 rows=226587 width=36)
                                                                          Sort Key: g.agency_id_a, g.stop_id_a
                                                                          ->  Seq Scan on stop_transfers g  (cost=0.00..4553.87 rows=226587 width=36)
                                                              ->  Index Scan using a_stop_idx on stop d  (cost=0.00..7.79 rows=1 width=44)
                                                                    Index Cond: (((agency_id)::text = (b.agency_id)::text) AND ((stop_id)::text = (b.stop_id)::text))
                                                        ->  Index Scan using trip_id_idx on trip e  (cost=0.00..8.71 rows=1 width=80)
                                                              Index Cond: ((trip_id)::text = (b.trip_id)::text)
                                                  ->  Index Scan using route_id_idx on route h  (cost=0.00..8.27 rows=1 width=41)
                                                        Index Cond: ((route_id)::text = (e.route_id)::text)
                                            ->  Index Scan using st_a_t_idx on stop_time a  (cost=0.00..40.80 rows=1 width=53)
                                                  Index Cond: (((agency_id)::text = (b.agency_id)::text) AND ((trip_id)::text = (b.trip_id)::text))
                                                  Filter: ((arrival_time >= '08:11:00'::interval) AND (arrival_time <= '08:30:00'::interval) AND ((stop_id)::text = 's101'::text))
                                      ->  Index Scan using a_stop_idx on stop c  (cost=0.00..8.40 rows=1 width=44)
                                            Index Cond: (((agency_id)::text = (a.agency_id)::text) AND ((stop_id)::text = (a.stop_id)::text))
                                ->  Index Scan using a_s_idx on calendar f  (cost=0.00..8.28 rows=1 width=20)
                                      Index Cond: (((agency_id)::text = (a.agency_id)::text) AND ((service_id)::text = (e.service_id)::text))
                                      Filter: monday
                          ->  Nested Loop  (cost=50.97..24729.27 rows=1 width=260)
                                ->  Nested Loop  (cost=50.97..24720.85 rows=1 width=223)
                                      Join Filter: (((a.stop_id)::text <> (b.stop_id)::text) AND (a.stop_sequence < b.stop_sequence) AND (a.arrival_time < b.arrival_time))
                                      ->  Nested Loop  (cost=50.97..24680.01 rows=1 width=232)
                                            ->  Nested Loop  (cost=50.97..24663.42 rows=2 width=236)
                                                  Join Filter: ((b.agency_id)::text = (h.agency_id)::text)
                                                  ->  Nested Loop  (cost=50.97..24447.16 rows=29 width=200)
                                                        Join Filter: ((b.agency_id)::text = (e.agency_id)::text)
                                                        ->  Nested Loop  (cost=50.97..15148.58 rows=1096 width=120)
                                                              ->  Nested Loop  (cost=50.97..12475.29 rows=59 width=80)
                                                                    ->  Bitmap Heap Scan on stop_transfers g  (cost=50.97..2141.81 rows=1375 width=36)
                                                                          Recheck Cond: ((agency_id_b)::text = '1A'::text)
                                                                          ->  Bitmap Index Scan on stop_transfers_as_b_idx  (cost=0.00..50.63 rows=1375 width=0)
                                                                                Index Cond: ((agency_id_b)::text = '1A'::text)
                                                                    ->  Index Scan using a_stop_idx on stop d  (cost=0.00..7.50 rows=1 width=44)
                                                                          Index Cond: (((agency_id)::text = (g.agency_id_a)::text) AND ((stop_id)::text = (g.stop_id_a)::text))
                                                              ->  Index Scan using st_a_s_idx on stop_time b  (cost=0.00..45.22 rows=6 width=53)
                                                                    Index Cond: (((agency_id)::text = (d.agency_id)::text) AND ((stop_id)::text = (d.stop_id)::text))
                                                        ->  Index Scan using trip_id_idx on trip e  (cost=0.00..8.47 rows=1 width=80)
                                                              Index Cond: ((trip_id)::text = (b.trip_id)::text)
                                                  ->  Index Scan using route_id_idx on route h  (cost=0.00..7.44 rows=1 width=41)
                                                        Index Cond: ((route_id)::text = (e.route_id)::text)
                                            ->  Index Scan using a_s_idx on calendar f  (cost=0.00..8.28 rows=1 width=20)
                                                  Index Cond: (((agency_id)::text = (b.agency_id)::text) AND ((service_id)::text = (e.service_id)::text))
                                                  Filter: monday
                                      ->  Index Scan using st_a_t_idx on stop_time a  (cost=0.00..40.78 rows=3 width=53)
                                            Index Cond: (((agency_id)::text = (b.agency_id)::text) AND ((trip_id)::text = (b.trip_id)::text))
                                ->  Index Scan using a_stop_idx on stop c  (cost=0.00..8.40 rows=1 width=44)
                                      Index Cond: (((agency_id)::text = (a.agency_id)::text) AND ((stop_id)::text = (a.stop_id)::text))
                    ->  Index Scan using agency_id_idx on agency i  (cost=0.00..8.27 rows=1 width=31)
                          Index Cond: ((agency_id)::text = (a.agency_id)::text)
              ->  Index Scan using agency_id_idx on agency i  (cost=0.00..8.27 rows=1 width=31)
                    Index Cond: ((agency_id)::text = (a.agency_id)::text)
  ->  Index Scan using agency_id_idx on agency i  (cost=0.00..8.27 rows=1 width=31)
        Index Cond: ((agency_id)::text = (a.agency_id)::text)