explain.depesz.com

PostgreSQL's explain analyze made readable

Result: OAyi

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=58,189.15..68,585.39 rows=186 width=220) (actual rows= loops=)

  • Group Key: '2018'::text, 842, comtrade_data_annual_refined.partner_code, comtrade_data_annual_refined.commodity_code, comtrade_data_annual_refined.aggregate_level, (((sum(comtrade_data_annual_refined.refined_value) FILTER (WHERE (comtrade_data_annual_refined.trade_flow_code = 1))))::bigint), (((sum(comtrade_data_annual_refined.refined_value) FILTER (WHERE (comtrade_data_annual_refined.trade_flow_code = 2))))::bigint)
2. 0.000 0.000 ↓ 0.0

Sort (cost=58,189.15..59,055.23 rows=346,433 width=196) (actual rows= loops=)

  • Sort Key: comtrade_data_annual_refined.partner_code, comtrade_data_annual_refined.commodity_code, comtrade_data_annual_refined.aggregate_level, (((sum(comtrade_data_annual_refined.refined_value) FILTER (WHERE (comtrade_data_annual_refined.trade_flow_code = 1))))::bigint), (((sum(comtrade_data_annual_refined.refined_value) FILTER (WHERE (comtrade_data_annual_refined.trade_flow_code = 2))))::bigint)
3. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=369.74..6,893.82 rows=346,433 width=196) (actual rows= loops=)

  • Hash Cond: (com.commodity_code = comtrade_data_annual_refined.commodity_code)
4. 0.000 0.000 ↓ 0.0

Seq Scan on commodities com (cost=0.00..780.20 rows=36,520 width=64) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Hash (cost=346.03..346.03 rows=1,897 width=176) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=289.01..346.03 rows=1,897 width=176) (actual rows= loops=)

  • Hash Cond: (reg.country_code = (842))
7. 0.000 0.000 ↓ 0.0

Seq Scan on region_countries reg (cost=0.00..30.40 rows=2,040 width=12) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Hash (cost=286.68..286.68 rows=186 width=172) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=281.03..286.68 rows=186 width=172) (actual rows= loops=)

  • Hash Cond: (comtrade_data_annual_refined.partner_code = par.reporter_code)
10. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=145.92..151.07 rows=186 width=140) (actual rows= loops=)

  • Hash Cond: ((842) = rep.reporter_code)
11. 0.000 0.000 ↓ 0.0

HashAggregate (cost=10.80..13.59 rows=186 width=140) (actual rows= loops=)

  • Group Key: comtrade_data_annual_refined.commodity_code, '2018'::text, 842, comtrade_data_annual_refined.partner_code, comtrade_data_annual_refined.aggregate_level
12. 0.000 0.000 ↓ 0.0

Index Only Scan using bulk_download_annual on comtrade_data_annual_refined (cost=0.70..6.62 rows=186 width=88) (actual rows= loops=)

  • Index Cond: ((year = '2018'::text) AND (reporter_code = 842))
13. 0.000 0.000 ↓ 0.0

Hash (cost=132.61..132.61 rows=200 width=36) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Subquery Scan on rep (cost=129.61..132.61 rows=200 width=36) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Unique (cost=129.61..130.61 rows=200 width=68) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Sort (cost=129.61..130.11 rows=200 width=68) (actual rows= loops=)

  • Sort Key: (COALESCE(reporters.reporter_code, partners.partner_code))
17. 0.000 0.000 ↓ 0.0

HashAggregate (cost=119.97..121.97 rows=200 width=68) (actual rows= loops=)

  • Group Key: COALESCE(reporters.reporter_code, partners.partner_code)
18. 0.000 0.000 ↓ 0.0

WindowAgg (cost=87.94..106.24 rows=915 width=136) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Sort (cost=87.94..90.23 rows=915 width=123) (actual rows= loops=)

  • Sort Key: (COALESCE(reporters.reporter, partners.partner))
20. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=9.97..42.94 rows=915 width=123) (actual rows= loops=)

  • Hash Cond: (reporters.reporter_code = partners.partner_code)
21. 0.000 0.000 ↓ 0.0

Seq Scan on reporters (cost=0.00..18.50 rows=850 width=68) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Hash (cost=6.10..6.10 rows=310 width=19) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Seq Scan on partners (cost=0.00..6.10 rows=310 width=19) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Hash (cost=132.61..132.61 rows=200 width=36) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Subquery Scan on par (cost=129.61..132.61 rows=200 width=36) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Unique (cost=129.61..130.61 rows=200 width=68) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Sort (cost=129.61..130.11 rows=200 width=68) (actual rows= loops=)

  • Sort Key: (COALESCE(reporters_1.reporter_code, partners_1.partner_code))
28. 0.000 0.000 ↓ 0.0

HashAggregate (cost=119.97..121.97 rows=200 width=68) (actual rows= loops=)

  • Group Key: COALESCE(reporters_1.reporter_code, partners_1.partner_code)
29. 0.000 0.000 ↓ 0.0

WindowAgg (cost=87.94..106.24 rows=915 width=136) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Sort (cost=87.94..90.23 rows=915 width=123) (actual rows= loops=)

  • Sort Key: (COALESCE(reporters_1.reporter, partners_1.partner))
31. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=9.97..42.94 rows=915 width=123) (actual rows= loops=)

  • Hash Cond: (reporters_1.reporter_code = partners_1.partner_code)
32. 0.000 0.000 ↓ 0.0

Seq Scan on reporters reporters_1 (cost=0.00..18.50 rows=850 width=68) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Hash (cost=6.10..6.10 rows=310 width=19) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Seq Scan on partners partners_1 (cost=0.00..6.10 rows=310 width=19) (actual rows= loops=)