explain.depesz.com

PostgreSQL's explain analyze made readable

Result: AEbe : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #Wfg3; plan #Bfjj; plan #moJ0; plan #RqCS; plan #tWiUD; plan #vdJC; plan #sgOS5

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.038 1.657 ↑ 1.0 1 1

Subquery Scan on results (cost=122.16..122.19 rows=1 width=96) (actual time=1.618..1.657 rows=1 loops=1)

2. 0.172 1.619 ↑ 1.0 1 1

CTE Scan on candidates (cost=122.16..122.18 rows=1 width=98) (actual time=1.598..1.619 rows=1 loops=1)

  • Filter: ($2 = special_airport)
  • Rows Removed by Filter: 1
3.          

CTE candidates

4. 0.435 0.435 ↓ 2.0 2 1

Index Scan using travel_cancellation_option_ma_partner_id_site_id_country_fa_idx on travel_cancellation_option_mapping tcom (cost=0.41..41.69 rows=1 width=133) (actual time=0.063..0.435 rows=2 loops=1)

  • Index Cond: ((partner_id = '1'::text) AND (site_id = '1'::text) AND (country = 'JP'::text) AND (fare_class = 'SuperValue'::text) AND ((currency)::text = 'JPY'::text) AND (price_band_1_item_count = 1) AND (price_band_1_price_start < '20000'::numeric) AND (price_band_1_price_end >= '20000'::numeric) AND (price_band_2_item_count = 1) AND (price_band_2_price_start < '10000'::numeric) AND (price_band_2_price_end >= '10000'::numeric))
  • Filter: ((allowed_airports IS NULL) OR ('{NRT,OKA}'::text[] <@ allowed_airports))
5.          

Initplan (forCTE Scan)

6. 0.374 1.447 ↑ 1.0 1 1

Aggregate (cost=80.46..80.47 rows=1 width=1) (actual time=1.427..1.447 rows=1 loops=1)

7. 0.326 1.073 ↓ 2.0 2 1

Nested Loop (cost=5.29..80.45 rows=1 width=33) (actual time=0.410..1.073 rows=2 loops=1)

8. 0.455 0.455 ↓ 2.0 2 1

CTE Scan on candidates candidates_1 (cost=0.00..0.02 rows=1 width=32) (actual time=0.029..0.455 rows=2 loops=1)

9. 0.162 0.292 ↑ 1.0 1 2

Bitmap Heap Scan on special_airports sa (cost=5.29..80.42 rows=1 width=66) (actual time=0.118..0.146 rows=1 loops=2)

  • Recheck Cond: ((mapping_id = candidates_1.id) AND (1 >= start_day) AND (9 >= start_month) AND (1 <= end_day) AND (9 <= end_month) AND (NOT is_deleted))
  • Filter: (('NRT'::text = code) OR ('OKA'::text = code))
  • Rows Removed by Filter: 12
  • Heap Blocks: exact=3
10. 0.130 0.130 ↑ 1.5 13 2

Bitmap Index Scan on special_airports_mapping_id_code_start_day_start_month_end__idx (cost=0.00..5.29 rows=19 width=0) (actual time=0.059..0.065 rows=13 loops=2)

  • Index Cond: ((mapping_id = candidates_1.id) AND (1 >= start_day) AND (9 >= start_month) AND (1 <= end_day) AND (9 <= end_month))