explain.depesz.com

PostgreSQL's explain analyze made readable

Result: fPYl : 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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.040 4.173 ↓ 0.0 0 1

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

2.          

CTE candidates

3. 0.419 0.419 ↓ 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.153..0.419 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.089 4.133 ↓ 0.0 0 1

Sort (cost=8.39..8.40 rows=1 width=96) (actual time=4.121..4.133 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.129 4.044 ↓ 0.0 0 1

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

6. 0.569 0.569 ↓ 2.0 2 1

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

  • Filter: (special_airport OR (NOT special_airport))
7. 3.346 3.346 ↓ 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=1.669..1.673 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