explain.depesz.com

PostgreSQL's explain analyze made readable

Result: edDv

Settings
# exclusive inclusive rows x rows loops node
1. 1.372 607.456 ↓ 2,497.0 2,497 1

Unique (cost=18,170.13..18,170.17 rows=1 width=608) (actual time=605.872..607.456 rows=2,497 loops=1)

2. 4.681 606.084 ↓ 3,372.0 3,372 1

Sort (cost=18,170.13..18,170.14 rows=1 width=608) (actual time=605.871..606.084 rows=3,372 loops=1)

  • Sort Key: r.companyname, r.company_id, r.ticker, r.yes_votes, r.no_votes, r.abstain_votes, r.shareholdermeetingdate, r.revenues, r.assets, r.marketcap, r.shares_out_fy, r.shareholder_proposals_id, (count(r.companyname) OVER (?))
  • Sort Method: quicksort Memory: 953kB
3. 2.685 601.403 ↓ 3,372.0 3,372 1

WindowAgg (cost=18,170.06..18,170.12 rows=1 width=608) (actual time=600.213..601.403 rows=3,372 loops=1)

4. 1.287 598.718 ↓ 3,372.0 3,372 1

Unique (cost=18,170.06..18,170.10 rows=1 width=608) (actual time=597.162..598.718 rows=3,372 loops=1)

5. 11.770 597.431 ↓ 3,372.0 3,372 1

Sort (cost=18,170.06..18,170.07 rows=1 width=608) (actual time=597.161..597.431 rows=3,372 loops=1)

  • Sort Key: r.companyname, r.company_id, r.ticker, r.yes_votes, r.no_votes, r.abstain_votes, r.shareholdermeetingdate, r.revenues, r.assets, r.marketcap, r.shares_out_fy, r.sector_id, r.shareholder_proposals_id
  • Sort Method: quicksort Memory: 953kB
6. 0.938 585.661 ↓ 3,372.0 3,372 1

Subquery Scan on r (cost=18,170.00..18,170.05 rows=1 width=608) (actual time=583.180..585.661 rows=3,372 loops=1)

  • Filter: (r.rank = 1)
  • Rows Removed by Filter: 15
7. 1.227 584.723 ↓ 3,387.0 3,387 1

Unique (cost=18,170.00..18,170.04 rows=1 width=644) (actual time=583.173..584.723 rows=3,387 loops=1)

8. 8.732 583.496 ↓ 3,387.0 3,387 1

Sort (cost=18,170.00..18,170.00 rows=1 width=644) (actual time=583.171..583.496 rows=3,387 loops=1)

  • Sort Key: (CASE COALESCE((fin.share_holder_meeting_date)::timestamp with time zone, to_timestamp('01/01/0001'::text, 'mm/dd/yyyy'::text)) WHEN to_timestamp('01/01/0001'::text, 'mm/dd/yyyy'::text) THEN COALESCE((s.submission_date)::timestamp with time zone, to_timestamp('01/01/0001'::text, 'mm/dd/yyyy'::text)) ELSE (fin.share_holder_meeting_date)::timestamp with time zone END) DESC NULLS LAST, (rank() OVER (?)), fin.fy_order, (COALESCE(mc.aka_co_name, mc.company_name)), mc.ticker, (CASE COALESCE(sp.yes_votes, '0'::bigint) WHEN '-999999999'::integer THEN '0'::bigint ELSE sp.yes_votes END), (CASE COALESCE(sp.no_votes, '0'::bigint) WHEN '-999999999'::integer THEN '0'::bigint ELSE sp.no_votes END), (CASE COALESCE(sp.abstain_votes, '0'::bigint) WHEN '-999999999'::integer THEN '0'::bigint ELSE sp.abstain_votes END), mc.company_id, mcs.sector_id, fin.revenues, fin.total_assets, finc.market_cap_fy, (COALESCE(fin.sh_out, '-999999999'::bigint)), sp.shareholder_proposals_id
  • Sort Method: quicksort Memory: 996kB
9. 8.222 574.764 ↓ 3,387.0 3,387 1

WindowAgg (cost=18,169.94..18,169.99 rows=1 width=644) (actual time=566.041..574.764 rows=3,387 loops=1)

10. 6.143 566.542 ↓ 3,387.0 3,387 1

Sort (cost=18,169.94..18,169.94 rows=1 width=162) (actual time=566.005..566.542 rows=3,387 loops=1)

  • Sort Key: fin.company_id, fin.share_holder_meeting_date DESC, s.submission_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 996kB
11. 114.588 560.399 ↓ 3,387.0 3,387 1

Nested Loop Left Join (cost=5,236.88..18,169.93 rows=1 width=162) (actual time=96.867..560.399 rows=3,387 loops=1)

  • Filter: (CASE COALESCE((fin.share_holder_meeting_date)::timestamp with time zone, to_timestamp('01/01/0001'::text, 'mm/dd/yyyy'::text)) WHEN to_timestamp('01/01/0001'::text, 'mm/dd/yyyy'::text) THEN COALESCE((s.submission_date)::timestamp with time zone, to_timestamp('01/01/0001'::text, 'mm/dd/yyyy'::text)) ELSE (fin.share_holder_meeting_date)::timestamp with time zone END >= (to_timestamp(((CURRENT_DATE - '1 year'::interval))::text, 'YYYY-MM-DD HH24:MI:SS'::text))::timestamp without time zone)
  • Rows Removed by Filter: 29747
12. 23.093 379.543 ↓ 33,134.0 33,134 1

Nested Loop Left Join (cost=5,236.60..18,169.55 rows=1 width=154) (actual time=96.768..379.543 rows=33,134 loops=1)

13. 28.672 284.846 ↓ 23,868.0 23,868 1

Nested Loop (cost=5,236.31..18,169.22 rows=1 width=146) (actual time=96.732..284.846 rows=23,868 loops=1)

14. 0.000 160.702 ↓ 23,868.0 23,868 1

Gather (cost=5,235.89..18,168.57 rows=1 width=154) (actual time=96.688..160.702 rows=23,868 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
15. 203.910 384.656 ↓ 7,956.0 7,956 3

Nested Loop (cost=4,235.89..17,168.47 rows=1 width=154) (actual time=78.090..384.656 rows=7,956 loops=3)

  • Join Filter: ((sp.company_id = fin.company_id) AND (sp.fiscal_year_id = fin.fiscal_year_id))
  • Rows Removed by Join Filter: 24937
16. 20.977 180.725 ↓ 5.6 7,971 3

Parallel Hash Join (cost=4,235.48..15,880.83 rows=1,429 width=111) (actual time=77.809..180.725 rows=7,971 loops=3)

  • Hash Cond: (sp.company_id = mc.company_id)
17. 84.315 84.315 ↓ 5.6 7,971 3

Parallel Seq Scan on shareholder_proposals sp (cost=0.00..11,641.60 rows=1,429 width=48) (actual time=0.106..84.315 rows=7,971 loops=3)

  • Filter: ((sub_category = 7) AND (sh_proposal_type = 9) AND (((CASE COALESCE(yes_votes, '0'::bigint) WHEN '-999999999'::integer THEN '0'::bigint ELSE COALESCE(yes_votes, '0'::bigint) END + CASE COALESCE(no_votes, '0'::bigint) WHEN '-999999999'::integer THEN '0'::bigint ELSE COALESCE(no_votes, '0'::bigint) END) + CASE COALESCE(abstain_votes, '0'::bigint) WHEN '-999999999'::integer THEN '0'::bigint ELSE COALESCE(abstain_votes, '0'::bigint) END) <> 0))
  • Rows Removed by Filter: 113031
18. 40.737 75.433 ↑ 1.8 40,056 3

Parallel Hash (cost=3,351.88..3,351.88 rows=70,688 width=63) (actual time=75.432..75.433 rows=40,056 loops=3)

  • Buckets: 131072 Batches: 1 Memory Usage: 10048kB
19. 34.696 34.696 ↑ 1.8 40,056 3

Parallel Seq Scan on master_company mc (cost=0.00..3,351.88 rows=70,688 width=63) (actual time=0.079..34.696 rows=40,056 loops=3)

20. 0.021 0.021 ↑ 1.2 4 23,914

Index Scan using financial_idx1 on financial fin (cost=0.42..0.83 rows=5 width=51) (actual time=0.009..0.021 rows=4 loops=23,914)

  • Index Cond: (company_id = mc.company_id)
21. 95.472 95.472 ↑ 1.0 1 23,868

Index Scan using financial_calc_pkey on financial_calc finc (cost=0.42..0.65 rows=1 width=16) (actual time=0.004..0.004 rows=1 loops=23,868)

  • Index Cond: (fiscal_year_id = fin.fiscal_year_id)
22. 71.604 71.604 ↑ 1.0 1 23,868

Index Scan using master_company_sector_idx1 on master_company_sector mcs (cost=0.29..0.32 rows=1 width=16) (actual time=0.002..0.003 rows=1 loops=23,868)

  • Index Cond: (company_id = mc.company_id)
23. 66.268 66.268 ↓ 0.0 0 33,134

Index Scan using sop_sub_date_idx on sop_sub_date s (cost=0.28..0.33 rows=1 width=16) (actual time=0.002..0.002 rows=0 loops=33,134)

  • Index Cond: (sp.shareholder_proposals_id = shareholder_proposals_id)
Planning time : 45.576 ms
Execution time : 615.470 ms