explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7uNN : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #jyov; plan #Yj9t; plan #vrTD; plan #iVmn; plan #BktC; plan #fDhb; plan #LebJ; plan #3ITz; plan #9KnD; plan #dlLn; plan #UOVe; plan #rA0r; plan #Vf18; plan #7924; plan #fPYl

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.020 0.630 ↓ 0.0 0 1

Unique (cost=50.08..50.09 rows=1 width=96) (actual time=0.621..0.630 rows=0 loops=1)

2.          

CTE candidates

3. 0.319 0.319 ↓ 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.108..0.319 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,HND}'::text[] <@ allowed_airports))
4. 0.044 0.610 ↓ 0.0 0 1

Sort (cost=8.39..8.40 rows=1 width=96) (actual time=0.600..0.610 rows=0 loops=1)

  • Sort Key: candidates.product_group_option_id, candidates.price_band_1_product_group_option_id, candidates.price_band_2_product_group_option_id
  • Sort Method: quicksort Memory: 25kB
5. 0.064 0.566 ↓ 0.0 0 1

Nested Loop (cost=0.55..8.38 rows=1 width=96) (actual time=0.555..0.566 rows=0 loops=1)

6. 0.398 0.398 ↓ 2.0 2 1

CTE Scan on candidates (cost=0.00..0.02 rows=1 width=129) (actual time=0.137..0.398 rows=2 loops=1)

  • Filter: (special_airport OR (NOT special_airport))
7. 0.104 0.104 ↓ 0.0 0 2

Index Only Scan using special_airports_mapping_id_code_start_day_start_month_end__idx on special_airports sa (cost=0.55..8.35 rows=1 width=53) (actual time=0.046..0.052 rows=0 loops=2)

  • Index Cond: (mapping_id = candidates.id)
  • Filter: ((((1 >= start_day) AND (1 <= end_day) AND (9 >= start_month) AND (9 <= end_month) AND (('NRT'::text = code) OR ('HND'::text = code))) OR (('NRT'::text = code) AND (1 < start_day) AND (1 > end_day) AND (9 < start_month) AND (9 > end_month) AND ('HND'::text = code) AND (1 < start_day) AND (1 > end_day) AND (9 < start_month) AND (9 > end_month))) AND ((candidates.special_airport AND (1 >= start_day) AND (1 <= end_day) AND (9 >= start_month) AND (9 <= end_month) AND (('NRT'::text = code) OR ('HND'::text = code))) OR ((NOT candidates.special_airport) AND ('NRT'::text = code) AND (1 < start_day) AND (1 > end_day) AND (9 < start_month) AND (9 > end_month) AND ('HND'::text = code) AND (1 < start_day) AND (1 > end_day) AND (9 < start_month) AND (9 > end_month))))
  • Rows Removed by Filter: 20
  • Heap Fetches: 0