explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZHF : Optimization for: Optimization for: Optimization for: Optimization for: plan #jKY1; plan #c0h; plan #Sw7j; plan #sL9F

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.004 11.269 ↑ 1.0 1 1

Subquery Scan on results (cost=1,448.75..1,448.78 rows=1 width=96) (actual time=11.268..11.269 rows=1 loops=1)

2. 3.982 11.265 ↑ 1.0 1 1

CTE Scan on candidates (cost=1,448.75..1,448.77 rows=1 width=98) (actual time=11.265..11.265 rows=1 loops=1)

  • Filter: ($6 = special_airport)
  • Rows Removed by Filter: 1
3.          

CTE candidates

4. 2.549 9.101 ↓ 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.28..1,431.76 rows=1 width=133) (actual time=2.268..9.101 rows=2 loops=1)

  • Index Cond: ((partner_id = '1'::text) AND (site_id = '1'::text) AND (country = 'JP'::text) AND ((currency)::text = 'JPY'::text) AND (price_band_1_item_count = 1) AND ('20000'::numeric >= price_band_1_price_start) AND ('20000'::numeric <= price_band_1_price_end) AND (price_band_2_item_count = 1) AND ('10000'::numeric >= price_band_2_price_start) AND ('10000'::numeric <= price_band_2_price_end))
  • Filter: (((allowed_airports IS NULL) OR ('{NRT,OKA}'::text[] <@ allowed_airports)) AND ((fare_class = 'SV21A'::text) OR (fare_class = (SubPlan 1))))
  • Rows Removed by Filter: 2
5.          

SubPlan (forIndex Scan)

6. 5.596 6.552 ↓ 0.0 0 4

Bitmap Heap Scan on fare_class_aliases (cost=11.35..674.61 rows=1 width=9) (actual time=1.174..1.638 rows=0 loops=4)

  • Recheck Cond: (alias = 'SV21A'::text)
  • Filter: ((NOT is_deleted) AND (mapping_id = tcom.id))
  • Rows Removed by Filter: 408
  • Heap Blocks: exact=1632
7. 0.956 0.956 ↑ 1.0 408 4

Bitmap Index Scan on fare_class_aliases_alias_idx (cost=0.00..11.35 rows=408 width=0) (actual time=0.239..0.239 rows=408 loops=4)

  • Index Cond: (alias = 'SV21A'::text)
8.          

Initplan (forCTE Scan)

9. 0.046 7.283 ↑ 1.0 1 1

Aggregate (cost=16.97..16.99 rows=1 width=1) (actual time=7.282..7.283 rows=1 loops=1)

10. 0.038 7.237 ↓ 2.0 2 1

Nested Loop (cost=0.41..16.97 rows=1 width=33) (actual time=0.220..7.237 rows=2 loops=1)

11. 6.853 6.853 ↓ 2.0 2 1

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

12. 0.056 0.346 ↑ 2.0 1 2

Nested Loop (cost=0.41..16.93 rows=2 width=66) (actual time=0.171..0.173 rows=1 loops=2)

13. 0.058 0.058 ↑ 1.0 2 2

Values Scan on "*VALUES*" (cost=0.00..0.03 rows=2 width=40) (actual time=0.026..0.029 rows=2 loops=2)

14. 0.232 0.232 ↓ 0.0 0 4

Index Scan using special_airports_mapping_id_code_start_day_start_month_end__idx on special_airports sa (cost=0.41..8.44 rows=1 width=86) (actual time=0.058..0.058 rows=0 loops=4)

  • Index Cond: ((mapping_id = candidates_1.id) AND (code = "*VALUES*".column1) AND (start_day <= "*VALUES*".column2) AND (start_month <= "*VALUES*".column3) AND (end_day >= "*VALUES*".column2) AND (end_month >= "*VALUES*".column3))