explain.depesz.com

PostgreSQL's explain analyze made readable

Result: khM

Settings
# exclusive inclusive rows x rows loops node
1. 5.132 1,577.481 ↓ 9,186.0 9,186 1

Unique (cost=18,178.01..18,178.05 rows=1 width=608) (actual time=1,571.539..1,577.481 rows=9,186 loops=1)

2. 18.771 1,572.349 ↓ 12,439.0 12,439 1

Sort (cost=18,178.01..18,178.02 rows=1 width=608) (actual time=1,571.537..1,572.349 rows=12,439 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: 3543kB
3. 11.911 1,553.578 ↓ 12,439.0 12,439 1

WindowAgg (cost=18,177.94..18,178.00 rows=1 width=608) (actual time=1,547.738..1,553.578 rows=12,439 loops=1)

4. 7.440 1,541.667 ↓ 12,439.0 12,439 1

Unique (cost=18,177.94..18,177.98 rows=1 width=608) (actual time=1,532.505..1,541.667 rows=12,439 loops=1)

5. 50.423 1,534.227 ↓ 12,439.0 12,439 1

Sort (cost=18,177.94..18,177.95 rows=1 width=608) (actual time=1,532.502..1,534.227 rows=12,439 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: 3542kB
6. 4.713 1,483.804 ↓ 12,439.0 12,439 1

Subquery Scan on r (cost=18,177.88..18,177.93 rows=1 width=608) (actual time=1,461.471..1,483.804 rows=12,439 loops=1)

  • Filter: (r.rank = 1)
  • Rows Removed by Filter: 15982
7. 13.629 1,479.091 ↓ 28,421.0 28,421 1

Unique (cost=18,177.88..18,177.92 rows=1 width=628) (actual time=1,461.463..1,479.091 rows=28,421 loops=1)

8. 65.268 1,465.462 ↓ 28,421.0 28,421 1

Sort (cost=18,177.88..18,177.88 rows=1 width=628) (actual time=1,461.459..1,465.462 rows=28,421 loops=1)

  • Sort Key: s.share_holder_meeting_date 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: 8318kB
9. 35.468 1,400.194 ↓ 28,421.0 28,421 1

WindowAgg (cost=18,177.84..18,177.87 rows=1 width=628) (actual time=1,359.980..1,400.194 rows=28,421 loops=1)

10. 48.208 1,364.726 ↓ 28,421.0 28,421 1

Sort (cost=18,177.84..18,177.84 rows=1 width=154) (actual time=1,359.948..1,364.726 rows=28,421 loops=1)

  • Sort Key: fin.company_id, s.share_holder_meeting_date DESC NULLS LAST
  • Sort Method: quicksort Memory: 8318kB
11. 13.870 1,316.518 ↓ 28,421.0 28,421 1

Nested Loop (cost=5,237.03..18,177.83 rows=1 width=154) (actual time=44.842..1,316.518 rows=28,421 loops=1)

12. 24.623 308.628 ↓ 33,134.0 33,134 1

Nested Loop Left Join (cost=5,236.60..18,169.55 rows=1 width=146) (actual time=44.729..308.628 rows=33,134 loops=1)

13. 25.472 212.401 ↓ 23,868.0 23,868 1

Nested Loop (cost=5,236.31..18,169.22 rows=1 width=138) (actual time=44.705..212.401 rows=23,868 loops=1)

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

Gather (cost=5,235.89..18,168.57 rows=1 width=146) (actual time=44.677..67.589 rows=23,868 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
15. 127.151 242.207 ↓ 7,956.0 7,956 3

Nested Loop (cost=4,235.89..17,168.47 rows=1 width=146) (actual time=35.995..242.207 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. 12.239 115.043 ↓ 5.6 7,971 3

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

  • Hash Cond: (sp.company_id = mc.company_id)
17. 67.590 67.590 ↓ 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.045..67.590 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. 19.468 35.214 ↑ 1.8 40,056 3

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

  • Buckets: 131072 Batches: 1 Memory Usage: 9984kB
19. 15.746 15.746 ↑ 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.033..15.746 rows=40,056 loops=3)

20. 0.013 0.013 ↑ 1.2 4 23,914

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

  • Index Cond: (company_id = mc.company_id)
21. 119.340 119.340 ↑ 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.005..0.005 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.003..0.003 rows=1 loops=23,868)

  • Index Cond: (company_id = mc.company_id)
23. 994.020 994.020 ↑ 1.0 1 33,134

Index Scan using sop_sub_date_idx on sop_sub_date s (cost=0.43..8.27 rows=1 width=16) (actual time=0.029..0.030 rows=1 loops=33,134)

  • Index Cond: (shareholder_proposals_id = sp.shareholder_proposals_id)
  • Filter: (share_holder_meeting_date >= (to_timestamp(((CURRENT_DATE - '1 year'::interval))::text, 'YYYY-MM-DD HH24:MI:SS'::text))::timestamp without time zone)
  • Rows Removed by Filter: 13