explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.835 2.982 ↑ 1.0 1 1

CTE Scan on candidates (cost=41.69..67.81 rows=1 width=98) (actual time=2.775..2.982 rows=1 loops=1)

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

CTE candidates

3. 0.568 0.568 ↓ 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.263..0.568 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))
4.          

SubPlan (forCTE Scan)

5. 0.136 1.043 ↑ 1.0 1 1

Aggregate (cost=13.04..13.05 rows=1 width=1) (actual time=1.010..1.043 rows=1 loops=1)

6. 0.171 0.907 ↑ 1.0 1 1

Bitmap Heap Scan on special_airports sa (cost=9.01..13.04 rows=1 width=33) (actual time=0.861..0.907 rows=1 loops=1)

  • Recheck Cond: (('NRT'::text = code) OR ((mapping_id = candidates.id) AND ('OKA'::text = code) AND (1 >= start_day) AND (9 >= start_month) AND (1 <= end_day) AND (9 <= end_month) AND (NOT is_deleted)))
  • Filter: ((NOT is_deleted) AND (1 >= start_day) AND (1 <= end_day) AND (9 >= start_month) AND (9 <= end_month) AND (mapping_id = candidates.id))
  • Heap Blocks: exact=1
7. 0.148 0.736 ↓ 0.0 0 1

BitmapOr (cost=9.01..9.01 rows=1 width=0) (actual time=0.723..0.736 rows=0 loops=1)

8. 0.080 0.080 ↓ 0.0 0 1

Bitmap Index Scan on special_airports_codes (cost=0.00..4.44 rows=1 width=0) (actual time=0.068..0.080 rows=0 loops=1)

  • Index Cond: ('NRT'::text = code)
9. 0.508 0.508 ↑ 1.0 1 1

Bitmap Index Scan on special_airports_mapping_id_code_start_day_start_month_end__idx (cost=0.00..4.57 rows=1 width=0) (actual time=0.492..0.508 rows=1 loops=1)

  • Index Cond: ((mapping_id = candidates.id) AND ('OKA'::text = code) AND (1 >= start_day) AND (9 >= start_month) AND (1 <= end_day) AND (9 <= end_month))
10. 0.222 1.104 ↑ 1.0 1 2

Aggregate (cost=13.04..13.05 rows=1 width=1) (actual time=0.532..0.552 rows=1 loops=2)

11. 0.276 0.882 ↑ 1.0 1 2

Bitmap Heap Scan on special_airports sa_1 (cost=9.01..13.04 rows=1 width=33) (actual time=0.413..0.441 rows=1 loops=2)

  • Recheck Cond: (('NRT'::text = code) OR ((mapping_id = candidates.id) AND ('OKA'::text = code) AND (1 >= start_day) AND (9 >= start_month) AND (1 <= end_day) AND (9 <= end_month) AND (NOT is_deleted)))
  • Filter: ((NOT is_deleted) AND (1 >= start_day) AND (1 <= end_day) AND (9 >= start_month) AND (9 <= end_month) AND (mapping_id = candidates.id))
  • Heap Blocks: exact=2
12. 0.260 0.606 ↓ 0.0 0 2

BitmapOr (cost=9.01..9.01 rows=1 width=0) (actual time=0.297..0.303 rows=0 loops=2)

13. 0.148 0.148 ↓ 0.0 0 2

Bitmap Index Scan on special_airports_codes (cost=0.00..4.44 rows=1 width=0) (actual time=0.068..0.074 rows=0 loops=2)

  • Index Cond: ('NRT'::text = code)
14. 0.198 0.198 ↑ 1.0 1 2

Bitmap Index Scan on special_airports_mapping_id_code_start_day_start_month_end__idx (cost=0.00..4.57 rows=1 width=0) (actual time=0.091..0.099 rows=1 loops=2)

  • Index Cond: ((mapping_id = candidates.id) AND ('OKA'::text = code) AND (1 >= start_day) AND (9 >= start_month) AND (1 <= end_day) AND (9 <= end_month))