explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bjWo8

Settings
# exclusive inclusive rows x rows loops node
1. 0.033 5,137.603 ↑ 1.0 1 1

Nested Loop Left Join (cost=10.78..763,099.92 rows=1 width=175) (actual time=5,137.469..5,137.603 rows=1 loops=1)

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

Nested Loop Left Join (cost=10.78..834.67 rows=1 width=119) (actual time=0.172..0.305 rows=1 loops=1)

3. 0.010 0.274 ↑ 1.0 1 1

Nested Loop Left Join (cost=10.63..826.10 rows=1 width=91) (actual time=0.142..0.274 rows=1 loops=1)

4. 0.155 0.216 ↑ 1.0 1 1

Bitmap Heap Scan on flights fl (cost=10.49..817.53 rows=1 width=63) (actual time=0.085..0.216 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.061 0.061 ↓ 1.4 396 1

Bitmap Index Scan on flights_flight_no_scheduled_departure_key (cost=0.00..10.49 rows=276 width=0) (actual time=0.061..0.061 rows=396 loops=1)

  • Index Cond: (flight_no = 'PG0134'::bpchar)
6. 0.048 0.048 ↑ 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.048..0.048 rows=1 loops=1)

  • Index Cond: (fl.departure_airport = airport_code)
7. 0.029 0.029 ↑ 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.029..0.029 rows=1 loops=1)

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

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

9.          

SubPlan (forNested Loop Left Join)

10. 0.033 1,247.371 ↑ 1.0 1 1

Aggregate (cost=174,831.41..174,831.42 rows=1 width=8) (actual time=1,247.371..1,247.371 rows=1 loops=1)

11. 1,247.338 1,247.338 ↑ 1.9 53 1

Seq Scan on ticket_flights tf_1 (cost=0.00..174,831.15 rows=102 width=0) (actual time=2.194..1,247.338 rows=53 loops=1)

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

Aggregate (cost=195,810.81..195,810.82 rows=1 width=8) (actual time=1,303.003..1,303.004 rows=1 loops=1)

13. 1,302.993 1,302.993 ↑ 1.0 11 1

Seq Scan on ticket_flights tf_2 (cost=0.00..195,810.78 rows=11 width=0) (actual time=2.348..1,302.993 rows=11 loops=1)

  • Filter: ((fl.flight_id = flight_id) AND ((fare_conditions)::text = 'Business'::text))
  • Rows Removed by Filter: 8391841
14. 0.004 1,293.683 ↑ 1.0 1 1

Aggregate (cost=195,810.79..195,810.80 rows=1 width=8) (actual time=1,293.683..1,293.683 rows=1 loops=1)

15. 1,293.679 1,293.679 ↓ 0.0 0 1

Seq Scan on ticket_flights tf_3 (cost=0.00..195,810.78 rows=2 width=0) (actual time=1,293.679..1,293.679 rows=0 loops=1)

  • Filter: ((fl.flight_id = flight_id) AND ((fare_conditions)::text = 'Comfort'::text))
  • Rows Removed by Filter: 8391852
16. 0.034 1,293.200 ↑ 1.0 1 1

Aggregate (cost=195,811.01..195,811.02 rows=1 width=8) (actual time=1,293.200..1,293.200 rows=1 loops=1)

17. 1,293.166 1,293.166 ↑ 2.1 42 1

Seq Scan on ticket_flights tf_4 (cost=0.00..195,810.78 rows=90 width=0) (actual time=13.080..1,293.166 rows=42 loops=1)

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