explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VUrT : Optimization for: plan #jKY1

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.019 7.302 ↑ 1.0 204 1

Subquery Scan on results (cost=7,768.98..7,780.18 rows=204 width=96) (actual time=7.244..7.302 rows=204 loops=1)

2. 0.112 7.283 ↑ 1.0 204 1

CTE Scan on candidates (cost=7,768.98..7,778.14 rows=204 width=98) (actual time=7.243..7.283 rows=204 loops=1)

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

CTE candidates

4. 0.866 0.866 ↓ 1.0 408 1

Index Scan using tcom_1 on travel_cancellation_option_mapping tcom (cost=0.41..750.19 rows=407 width=133) (actual time=0.044..0.866 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))
  • Filter: ((allowed_airports IS NULL) OR ('{NRT,OKA}'::text[] <@ allowed_airports))
5.          

Initplan (forCTE Scan)

6. 0.039 7.171 ↑ 1.0 1 1

Aggregate (cost=7,018.78..7,018.79 rows=1 width=1) (actual time=7.170..7.171 rows=1 loops=1)

7. 0.043 7.132 ↓ 25.5 408 1

Nested Loop (cost=0.55..7,018.74 rows=16 width=33) (actual time=4.079..7.132 rows=408 loops=1)

8. 0.003 0.003 ↑ 1.0 2 1

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

9. 0.302 7.086 ↑ 2.0 204 2

Nested Loop (cost=0.55..3,505.29 rows=407 width=53) (actual time=2.038..3.543 rows=204 loops=2)

10. 1.072 1.072 ↓ 1.0 408 2

CTE Scan on candidates candidates_1 (cost=0.00..8.14 rows=407 width=32) (actual time=0.000..0.536 rows=408 loops=2)

11. 5.712 5.712 ↓ 0.0 0 816

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.007..0.007 rows=0 loops=816)

  • 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))