explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gmN1

Settings
# exclusive inclusive rows x rows loops node
1. 47.314 80,905.421 ↓ 2.0 107,789 1

Subquery Scan on result (cost=19,442,620.35..19,450,179.82 rows=53,395 width=120) (actual time=80,789.726..80,905.421 rows=107,789 loops=1)

2. 62.832 80,858.107 ↓ 2.0 107,789 1

Merge Left Join (cost=19,442,620.35..19,445,240.78 rows=53,395 width=130) (actual time=80,789.718..80,858.107 rows=107,789 loops=1)

  • Merge Cond: ((refined_1.commodity_code = comtrade_data_monthly.commodity_code) AND (refined_1.aggregate_level = comtrade_data_monthly.aggregate_level) AND (refined_1.year = comtrade_data_monthly.year) AND
  • Join Filter: ((refined_1.period = comtrade_data_monthly.period) AND (refined_1.reporter_code = comtrade_data_monthly.reporter_code))
  • Filter: ((refined_1.partner_code <> COALESCE(refined_1.reporter_code, comtrade_data_monthly.reporter_code)) AND (GREATEST((COALESCE(refined_1.trade_value, '0'::text))::double precision, (COALESCE(comtrade
3. 228.642 80,765.518 ↑ 1.5 107,789 1

Sort (cost=19,433,534.33..19,433,936.45 rows=160,851 width=35) (actual time=80,759.936..80,765.518 rows=107,789 loops=1)

  • Sort Key: refined_1.commodity_code, refined_1.aggregate_level, refined_1.year, refined_1.partner_code
  • Sort Method: quicksort Memory: 11494kB
4. 80,536.876 80,536.876 ↑ 1.5 107,789 1

Index Only Scan using agg_tf_rep_partial_monthly on comtrade_data_monthly refined_1 (cost=0.57..19,419,624.44 rows=160,851 width=35) (actual time=6,958.517..80,536.876 rows=107,789 loops=1)

  • Index Cond: ((period = '201010'::text) AND (reporter_code = 842))
  • Filter: ((aggregate_level <> 0) AND (partner_code <> 0))
  • Rows Removed by Filter: 6329
  • Heap Fetches: 0
5. 0.012 29.757 ↓ 0.0 0 1

Sort (cost=9,086.02..9,099.78 rows=5,503 width=35) (actual time=29.757..29.757 rows=0 loops=1)

  • Sort Key: comtrade_data_monthly.commodity_code, comtrade_data_monthly.aggregate_level, comtrade_data_monthly.year, comtrade_data_monthly.partner_code
  • Sort Method: quicksort Memory: 25kB
6. 29.745 29.745 ↓ 0.0 0 1

Index Only Scan using agg_tf_part_partial_monthly_v3 on comtrade_data_monthly (cost=0.57..8,744.12 rows=5,503 width=35) (actual time=29.745..29.745 rows=0 loops=1)

  • Index Cond: ((period = '201010'::text) AND (partner_code = 842))
  • Filter: (reporter_code = 842)
  • Rows Removed by Filter: 100374
  • Heap Fetches: 0