explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.085 0.367 ↑ 1.0 1 1

CTE Scan on candidates (cost=194.75..194.77 rows=1 width=98) (actual time=0.367..0.367 rows=1 loops=1)

  • Filter: ($4 = special_airport)
  • Rows Removed by Filter: 1
2.          

CTE candidates

3. 0.223 0.223 ↓ 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.077..0.223 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.          

Initplan (forCTE Scan)

5. 0.002 0.064 ↑ 1.0 1 1

Aggregate (cost=76.52..76.53 rows=1 width=1) (actual time=0.064..0.064 rows=1 loops=1)

6. 0.007 0.062 ↓ 2.0 2 1

Nested Loop (cost=5.27..76.52 rows=1 width=33) (actual time=0.033..0.062 rows=2 loops=1)

7. 0.001 0.001 ↓ 2.0 2 1

CTE Scan on candidates candidates_1 (cost=0.00..0.02 rows=1 width=32) (actual time=0.001..0.001 rows=2 loops=1)

8. 0.010 0.054 ↑ 1.0 1 2

Bitmap Heap Scan on special_airports sa (cost=5.27..76.49 rows=1 width=66) (actual time=0.024..0.027 rows=1 loops=2)

  • Recheck Cond: ((mapping_id = candidates_1.id) AND (1 >= start_day) AND (9 >= start_month) AND (1 <= end_day) AND (9 <= end_month) AND (NOT is_deleted))
  • Filter: (('NRT'::text = code) OR ('OKA'::text = code))
  • Rows Removed by Filter: 12
  • Heap Blocks: exact=3
9. 0.044 0.044 ↑ 1.4 13 2

Bitmap Index Scan on special_airports_mapping_id_code_start_day_start_month_end__idx (cost=0.00..5.27 rows=18 width=0) (actual time=0.022..0.022 rows=13 loops=2)

  • Index Cond: ((mapping_id = candidates_1.id) AND (1 >= start_day) AND (9 >= start_month) AND (1 <= end_day) AND (9 <= end_month))
10. 0.004 0.218 ↑ 1.0 1 1

Aggregate (cost=76.52..76.53 rows=1 width=1) (actual time=0.218..0.218 rows=1 loops=1)

11. 0.008 0.214 ↓ 2.0 2 1

Nested Loop (cost=5.27..76.52 rows=1 width=33) (actual time=0.034..0.214 rows=2 loops=1)

12. 0.148 0.148 ↓ 2.0 2 1

CTE Scan on candidates candidates_2 (cost=0.00..0.02 rows=1 width=32) (actual time=0.001..0.148 rows=2 loops=1)

13. 0.016 0.058 ↑ 1.0 1 2

Bitmap Heap Scan on special_airports sa_1 (cost=5.27..76.49 rows=1 width=66) (actual time=0.025..0.029 rows=1 loops=2)

  • Recheck Cond: ((mapping_id = candidates_2.id) AND (1 >= start_day) AND (9 >= start_month) AND (1 <= end_day) AND (9 <= end_month) AND (NOT is_deleted))
  • Filter: (('NRT'::text = code) OR ('OKA'::text = code))
  • Rows Removed by Filter: 12
  • Heap Blocks: exact=3
14. 0.042 0.042 ↑ 1.4 13 2

Bitmap Index Scan on special_airports_mapping_id_code_start_day_start_month_end__idx (cost=0.00..5.27 rows=18 width=0) (actual time=0.021..0.021 rows=13 loops=2)

  • Index Cond: ((mapping_id = candidates_2.id) AND (1 >= start_day) AND (9 >= start_month) AND (1 <= end_day) AND (9 <= end_month))