explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NufK

Settings
# exclusive inclusive rows x rows loops node
1. 337.052 1,154.609 ↑ 2.2 142,333 1

Merge Full Join (cost=218,830.32..346,975.74 rows=320,092 width=120) (actual time=797.663..1,154.609 rows=142,333 loops=1)

  • Merge Cond: ((raw_monthly_imports.reporter_code = raw_monthly_exports.partner_code) AND (raw_monthly_imports.partner_code = raw_monthly_exports.reporter_code) AND (raw_monthly_imports.commodity_code = raw_month
  • Filter: (GREATEST((COALESCE(raw_monthly_imports.trade_value, '0'::text))::double precision, (COALESCE(raw_monthly_exports.trade_value, '0'::text))::double precision) > '0'::double precision)
  • Rows Removed by Filter: 6
2. 379.242 422.743 ↑ 8.9 107,789 1

Sort (cost=114,801.84..117,202.53 rows=960,276 width=39) (actual time=411.831..422.743 rows=107,789 loops=1)

  • Sort Key: raw_monthly_imports.reporter_code, raw_monthly_imports.partner_code, raw_monthly_imports.commodity_code, raw_monthly_imports.aggregate_level, raw_monthly_imports.year, raw_monthly_imports.period
  • Sort Method: quicksort Memory: 11494kB
3. 12.999 43.501 ↑ 8.9 107,789 1

Hash Left Join (cost=25.65..19,383.59 rows=960,276 width=39) (actual time=0.040..43.501 rows=107,789 loops=1)

  • Hash Cond: (raw_monthly_imports.reporter_code = ir.result_reporter_code)
4. 30.498 30.498 ↑ 1.5 107,789 1

Index Only Scan using agg_tf_rep_partial_monthly_v3 on comtrade_data_monthly raw_monthly_imports (cost=0.57..9,155.58 rows=160,046 width=35) (actual time=0.031..30.498 rows=107,789 loops=1)

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

Hash (cost=25.00..25.00 rows=6 width=8) (actual time=0.004..0.004 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
6. 0.004 0.004 ↓ 0.0 0 1

Seq Scan on import_reliability ir (cost=0.00..25.00 rows=6 width=8) (actual time=0.004..0.004 rows=0 loops=1)

  • Filter: (result_reporter_code = 842)
7. 356.436 394.814 ↑ 8.7 100,374 1

Sort (cost=104,028.47..106,215.97 rows=874,998 width=39) (actual time=385.796..394.814 rows=100,374 loops=1)

  • Sort Key: raw_monthly_exports.partner_code, raw_monthly_exports.reporter_code, raw_monthly_exports.commodity_code, raw_monthly_exports.aggregate_level, raw_monthly_exports.year, raw_monthly_exports.period
  • Sort Method: quicksort Memory: 10914kB
8. 13.334 38.378 ↑ 8.7 100,374 1

Hash Left Join (cost=25.65..17,670.90 rows=874,998 width=39) (actual time=0.059..38.378 rows=100,374 loops=1)

  • Hash Cond: (raw_monthly_exports.partner_code = er.result_reporter_code)
9. 25.037 25.037 ↑ 1.5 100,374 1

Index Only Scan using agg_tf_part_partial_monthly_v3 on comtrade_data_monthly raw_monthly_exports (cost=0.57..8,348.97 rows=145,833 width=35) (actual time=0.043..25.037 rows=100,374 loops=1)

  • Index Cond: ((period = '201010'::text) AND (partner_code = 842))
  • Heap Fetches: 0
10. 0.001 0.007 ↓ 0.0 0 1

Hash (cost=25.00..25.00 rows=6 width=8) (actual time=0.006..0.007 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
11. 0.006 0.006 ↓ 0.0 0 1

Seq Scan on export_reliability er (cost=0.00..25.00 rows=6 width=8) (actual time=0.006..0.006 rows=0 loops=1)

  • Filter: (result_reporter_code = 842)
Planning time : 1.186 ms
Execution time : 1,162.117 ms