explain.depesz.com

PostgreSQL's explain analyze made readable

Result: OMT8 : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #vOOL; plan #AU1g; plan #v3gH; plan #D3Wj; plan #6huQ; plan #vXAm

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.003 10.089 ↑ 1.0 1 1

Subquery Scan on results (cost=639.27..639.30 rows=1 width=96) (actual time=10.088..10.089 rows=1 loops=1)

2. 9.529 10.086 ↑ 1.0 1 1

CTE Scan on candidates (cost=639.27..639.29 rows=1 width=98) (actual time=10.086..10.086 rows=1 loops=1)

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

CTE candidates

4. 0.590 9.954 ↓ 2.0 2 1

Bitmap Heap Scan on travel_cancellation_option_mapping tcom (cost=341.22..622.01 rows=1 width=133) (actual time=9.520..9.954 rows=2 loops=1)

  • Recheck 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 (20000.0 <@ price_band_1_range))
  • Filter: ((NOT is_deleted) AND (10000.0 <@ price_band_2_range) AND ((allowed_airports IS NULL) OR ('{NRT,OKA}'::text[] <@ allowed_airports)) AND (price_band_1_item_count = 1) AND (price_band_2_item_count = 1))
  • Rows Removed by Filter: 70
  • Heap Blocks: exact=72
5. 0.862 9.364 ↓ 0.0 0 1

BitmapAnd (cost=341.22..341.22 rows=73 width=0) (actual time=9.364..9.364 rows=0 loops=1)

6. 0.369 0.369 ↑ 1.0 408 1

Bitmap Index Scan on tcom_1 (cost=0.00..19.55 rows=408 width=0) (actual time=0.369..0.369 rows=408 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))
7. 8.133 8.133 ↑ 1.0 7,992 1

Bitmap Index Scan on tcom_2 (cost=0.00..321.42 rows=8,152 width=0) (actual time=8.133..8.133 rows=7,992 loops=1)

  • Index Cond: (20000.0 <@ price_band_1_range)
8.          

Initplan (forCTE Scan)

9. 0.011 0.557 ↑ 1.0 1 1

Aggregate (cost=17.25..17.27 rows=1 width=1) (actual time=0.557..0.557 rows=1 loops=1)

10. 0.011 0.546 ↓ 2.0 2 1

Nested Loop (cost=0.55..17.25 rows=1 width=33) (actual time=0.060..0.546 rows=2 loops=1)

11. 0.447 0.447 ↓ 2.0 2 1

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

12. 0.010 0.088 ↑ 2.0 1 2

Nested Loop (cost=0.55..17.21 rows=2 width=66) (actual time=0.042..0.044 rows=1 loops=2)

13. 0.010 0.010 ↑ 1.0 2 2

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

14. 0.068 0.068 ↓ 0.0 0 4

Index Scan using special_airports_mapping_id_code_start_day_start_month_end__idx on special_airports sa (cost=0.55..8.58 rows=1 width=86) (actual time=0.016..0.017 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))