explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.046 1,233.823 ↑ 1.0 1 1

Unique (cost=18,761.45..18,761.47 rows=1 width=96) (actual time=1,233.770..1,233.823 rows=1 loops=1)

2.          

CTE candidates

3. 1.262 1.262 ↓ 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.987..1.262 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. 0.077 1,233.777 ↓ 2.0 2 1

Sort (cost=18,719.77..18,719.77 rows=1 width=96) (actual time=1,233.751..1,233.777 rows=2 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. 533.538 1,233.700 ↓ 2.0 2 1

Hash Join (cost=992.67..18,719.76 rows=1 width=96) (actual time=58.799..1,233.700 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)))
6. 681.930 698.784 ↓ 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=21.057..698.784 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
7. 0.028 16.854 ↓ 0.0 0 1

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

8. 12.671 12.671 ↑ 1.0 22,644 1

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

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

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

  • Index Cond: ('OKA'::text = code)
10. 0.042 1.378 ↓ 2.0 2 1

Hash (cost=0.02..0.02 rows=1 width=129) (actual time=1.369..1.378 rows=2 loops=1)

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

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

  • Filter: (special_airport OR (NOT special_airport))