explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 527.930 1,327.701 ↓ 2.0 2 1

Hash Join (cost=1,034.36..18,761.44 rows=1 width=96) (actual time=73.750..1,327.701 rows=2 loops=1)

  • Hash Cond: (sa.mapping_id = candidates.id)
  • Join Filter: (((NOT sa.is_deleted) AND candidates.special_airport AND (1 >= sa.start_day) AND (1 <= sa.end_day) AND (9 >= sa.start_month) AND (9 <= sa.end_month)) OR ((NOT candidates.special_airport) AND (1 < sa.start_day) AND (1 > sa.end_day) AND (9 < sa.start_month) AND (9 > sa.end_month)))
2.          

CTE candidates

3. 0.329 0.329 ↓ 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.093..0.329 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 ('{HND,OSA}'::text[] <@ allowed_airports))
4. 784.175 799.338 ↓ 2.3 45,288 1

Bitmap Heap Scan on special_airports sa (cost=992.64..18,644.55 rows=20,038 width=50) (actual time=41.751..799.338 rows=45,288 loops=1)

  • Recheck Cond: (('KTD'::text = code) OR ('OKA'::text = code))
  • Filter: (((NOT is_deleted) AND (1 >= start_day) AND (1 <= end_day) AND (9 >= start_month) AND (9 <= end_month)) OR ((1 < start_day) AND (1 > end_day) AND (9 < start_month) AND (9 > end_month)))
  • Heap Blocks: exact=16057
5. 0.031 15.163 ↓ 0.0 0 1

BitmapOr (cost=992.64..992.64 rows=45,569 width=0) (actual time=15.154..15.163 rows=0 loops=1)

6. 11.210 11.210 ↑ 1.0 22,644 1

Bitmap Index Scan on special_airports_codes (cost=0.00..491.97 rows=22,873 width=0) (actual time=11.201..11.210 rows=22,644 loops=1)

  • Index Cond: ('KTD'::text = code)
7. 3.922 3.922 ↑ 1.0 22,644 1

Bitmap Index Scan on special_airports_codes (cost=0.00..490.65 rows=22,696 width=0) (actual time=3.913..3.922 rows=22,644 loops=1)

  • Index Cond: ('OKA'::text = code)
8. 0.041 0.433 ↓ 2.0 2 1

Hash (cost=0.02..0.02 rows=1 width=129) (actual time=0.424..0.433 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
9. 0.392 0.392 ↓ 2.0 2 1

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

  • Filter: (special_airport OR (NOT special_airport))