explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7VYG

Settings
# exclusive inclusive rows x rows loops node
1. 0.034 2,656.701 ↑ 1.0 1 1

Nested Loop Left Join (cost=10.78..538,819.57 rows=1 width=175) (actual time=2,656.581..2,656.701 rows=1 loops=1)

  • Join Filter: (fl.aircraft_code = ac.aircraft_code)
  • Rows Removed by Join Filter: 5
2. 0.001 0.254 ↑ 1.0 1 1

Nested Loop Left Join (cost=10.78..837.27 rows=1 width=119) (actual time=0.135..0.254 rows=1 loops=1)

3. 0.003 0.234 ↑ 1.0 1 1

Nested Loop Left Join (cost=10.64..828.70 rows=1 width=91) (actual time=0.115..0.234 rows=1 loops=1)

4. 0.142 0.187 ↑ 1.0 1 1

Bitmap Heap Scan on flights fl (cost=10.50..820.13 rows=1 width=63) (actual time=0.068..0.187 rows=1 loops=1)

  • Recheck Cond: (flight_no = 'PG0134'::bpchar)
  • Filter: (date(scheduled_departure) = '2017-02-15'::date)
  • Rows Removed by Filter: 395
  • Heap Blocks: exact=6
5. 0.045 0.045 ↓ 1.4 396 1

Bitmap Index Scan on flights_flight_no_scheduled_departure_key (cost=0.00..10.50 rows=277 width=0) (actual time=0.045..0.045 rows=396 loops=1)

  • Index Cond: (flight_no = 'PG0134'::bpchar)
6. 0.044 0.044 ↑ 1.0 1 1

Index Scan using airports_data_pkey on airports_data ml (cost=0.14..8.41 rows=1 width=36) (actual time=0.044..0.044 rows=1 loops=1)

  • Index Cond: (fl.departure_airport = airport_code)
7. 0.019 0.019 ↑ 1.0 1 1

Index Scan using airports_data_pkey on airports_data ml_1 (cost=0.14..8.41 rows=1 width=36) (actual time=0.018..0.019 rows=1 loops=1)

  • Index Cond: (fl.arrival_airport = airport_code)
8. 0.006 0.006 ↑ 1.5 6 1

Seq Scan on aircrafts_data ac (cost=0.00..1.09 rows=9 width=68) (actual time=0.006..0.006 rows=6 loops=1)

9.          

SubPlan (forNested Loop Left Join)

10. 0.036 1,148.008 ↑ 1.0 1 1

Aggregate (cost=174,832.75..174,832.76 rows=1 width=8) (actual time=1,148.008..1,148.008 rows=1 loops=1)

11. 1,147.972 1,147.972 ↑ 1.9 53 1

Seq Scan on ticket_flights tf_1 (cost=0.00..174,832.50 rows=101 width=0) (actual time=2.342..1,147.972 rows=53 loops=1)

  • Filter: (fl.flight_id = flight_id)
  • Rows Removed by Filter: 8391799
12. 0.011 276.561 ↑ 1.0 1 1

Aggregate (cost=97,063.07..97,063.08 rows=1 width=8) (actual time=276.561..276.561 rows=1 loops=1)

13. 276.550 276.550 ↓ 1.1 11 1

Index Scan using t_f_fare_c_idx on ticket_flights tf_2 (cost=0.43..97,063.05 rows=10 width=0) (actual time=4.919..276.550 rows=11 loops=1)

  • Index Cond: ((fare_conditions)::text = 'Business'::text)
  • Filter: (fl.flight_id = flight_id)
  • Rows Removed by Filter: 859645
14. 0.004 44.784 ↑ 1.0 1 1

Aggregate (cost=70,272.61..70,272.62 rows=1 width=8) (actual time=44.784..44.784 rows=1 loops=1)

15. 44.780 44.780 ↓ 0.0 0 1

Index Scan using t_f_fare_c_idx on ticket_flights tf_3 (cost=0.43..70,272.60 rows=2 width=0) (actual time=44.780..44.780 rows=0 loops=1)

  • Index Cond: ((fare_conditions)::text = 'Comfort'::text)
  • Filter: (fl.flight_id = flight_id)
  • Rows Removed by Filter: 139965
16. 0.027 1,187.054 ↑ 1.0 1 1

Aggregate (cost=195,812.62..195,812.63 rows=1 width=8) (actual time=1,187.054..1,187.054 rows=1 loops=1)

17. 1,187.027 1,187.027 ↑ 2.1 42 1

Seq Scan on ticket_flights tf_4 (cost=0.00..195,812.40 rows=89 width=0) (actual time=9.496..1,187.027 rows=42 loops=1)

  • Filter: ((fl.flight_id = flight_id) AND ((fare_conditions)::text = 'Economy'::text))
  • Rows Removed by Filter: 8391810