explain.depesz.com

PostgreSQL's explain analyze made readable

Result: I7ib : ewq

Settings
# exclusive inclusive rows x rows loops node
1. 5.665 41,321.756 ↓ 3,196.0 3,196 1

WindowAgg (cost=2,514,504.39..2,514,504.46 rows=1 width=342) (actual time=41,312.817..41,321.756 rows=3,196 loops=1)

2. 19.156 41,316.091 ↓ 3,196.0 3,196 1

HashAggregate (cost=2,514,504.39..2,514,504.43 rows=1 width=342) (actual time=41,312.791..41,316.091 rows=3,196 loops=1)

  • Group Key: custodial_securities.cusip, custodial_securities.fund, custodial_securities.sub_fund, programs.program_type, workgroups.name, workgroups.code, reps.last_name, reps.first_name, rep_codes.code, rep_codes.rep_type_code, rep_codes.product_type_code, rep_codes.tier_class_code, contacts_classic_users.id, contacts.classic_urn, contacts.last_name, contacts.first_name, contacts_mvbalances_mvw.contact_market_value, contacts_mvbalances_mvw.contact_money_market_balance, custodial_accounts.number, accounts.acctype, accounts.title, held_wheres.id, contacts_mvbalances_mvw.account_market_value, contacts_mvbalances_mvw.account_money_market_balance, custodial_accounts.opened_on, custodial_securities.symbol, custodial_securities.full_description, custodial_cost_basis_details.cost_basis, custodial_asset_classes.id, custodial_asset_product_subgroups.id
3. 4.706 41,296.935 ↓ 3,204.0 3,204 1

Nested Loop Semi Join (cost=2,177,332.02..2,514,504.29 rows=1 width=342) (actual time=33,886.549..41,296.935 rows=3,204 loops=1)

  • Join Filter: (account_forms_collections.contact_id = contacts_1.id)
4. 4.068 41,244.169 ↓ 3,204.0 3,204 1

Nested Loop Left Join (cost=2,177,331.59..2,514,496.84 rows=1 width=358) (actual time=33,886.515..41,244.169 rows=3,204 loops=1)

5. 1.935 40,349.812 ↓ 3,191.0 3,191 1

Nested Loop Left Join (cost=2,177,331.16..2,514,489.43 rows=1 width=339) (actual time=33,880.780..40,349.812 rows=3,191 loops=1)

6. 8.491 40,341.495 ↓ 3,191.0 3,191 1

Nested Loop Left Join (cost=2,177,331.02..2,514,487.25 rows=1 width=322) (actual time=33,880.771..40,341.495 rows=3,191 loops=1)

  • Join Filter: (custodial_asset_classes.id = casset.custodial_asset_class_id)
  • Rows Removed by Join Filter: 28719
7. 1.690 40,329.813 ↓ 3,191.0 3,191 1

Nested Loop Left Join (cost=2,177,331.02..2,514,486.03 rows=1 width=311) (actual time=33,880.762..40,329.813 rows=3,191 loops=1)

8. 3.554 40,315.359 ↓ 3,191.0 3,191 1

Nested Loop Left Join (cost=2,177,330.74..2,514,479.29 rows=1 width=290) (actual time=33,880.683..40,315.359 rows=3,191 loops=1)

  • Join Filter: (custodial_securities.id = custodial_cost_basis_summaries.custodial_security_id)
9. 2.564 40,308.614 ↓ 3,191.0 3,191 1

Hash Join (cost=2,177,330.45..2,514,472.50 rows=1 width=284) (actual time=33,880.675..40,308.614 rows=3,191 loops=1)

  • Hash Cond: (owners_contacts_join.workgroup_id = workgroups.id)
10. 2.757 40,305.994 ↓ 28.7 3,191 1

Hash Left Join (cost=2,177,313.84..2,514,455.47 rows=111 width=258) (actual time=33,880.611..40,305.994 rows=3,191 loops=1)

  • Hash Cond: (securities_custodial_latest_positions_mvw.custodial_asset_id = casset.id)
11. 3.678 40,302.767 ↓ 28.7 3,191 1

Nested Loop Left Join (cost=2,177,295.16..2,514,435.27 rows=111 width=250) (actual time=33,880.127..40,302.767 rows=3,191 loops=1)

12. 3.810 39,810.866 ↓ 28.7 3,191 1

Nested Loop (cost=2,177,294.74..2,513,613.08 rows=111 width=250) (actual time=33,879.377..39,810.866 rows=3,191 loops=1)

13. 123.569 39,794.292 ↓ 16.6 3,191 1

Hash Join (cost=2,177,294.31..2,512,091.49 rows=192 width=235) (actual time=33,879.349..39,794.292 rows=3,191 loops=1)

  • Hash Cond: (contacts.rep_code_mapping_id = rep_code_mappings_contacts_join.id)
14. 639.939 39,666.874 ↑ 1.3 1,688,546 1

Hash Join (cost=2,177,238.70..2,504,077.98 rows=2,121,685 width=218) (actual time=33,596.375..39,666.874 rows=1,688,546 loops=1)

  • Hash Cond: (contacts.owner_id = owners_contacts_join.id)
15. 1,304.331 39,015.414 ↑ 1.3 1,688,546 1

Hash Join (cost=2,175,081.79..2,459,451.96 rows=2,125,227 width=210) (actual time=33,584.839..39,015.414 rows=1,688,546 loops=1)

  • Hash Cond: (custodial_latest_positions_mvw.custodial_security_id = custodial_securities.id)
16. 2,430.863 37,323.517 ↑ 1.3 1,694,145 1

Hash Join (cost=2,144,435.85..2,388,912.65 rows=2,130,411 width=152) (actual time=33,197.071..37,323.517 rows=1,694,145 loops=1)

  • Hash Cond: (custodial_latest_positions_mvw.custodial_account_id = custodial_accounts.id)
17. 1,700.719 1,700.719 ↑ 1.0 2,599,537 1

Seq Scan on custodial_latest_positions_mvw (cost=0.00..152,689.64 rows=2,599,920 width=41) (actual time=0.020..1,700.719 rows=2,599,537 loops=1)

  • Filter: ((valued_on >= '2019-12-31'::date) AND (valued_on <= '2020-01-31'::date) AND (valued_on >= '2019-11-30'::date) AND (valued_on <= '2020-01-31'::date) AND (valued_on >= '2019-10-31'::date) AND (valued_on <= '2020-01-31'::date) AND (valued_on >= '2019-09-30'::date) AND (valued_on <= '2020-01-31'::date) AND (valued_on >= '2019-08-31'::date) AND (valued_on <= '2020-01-31'::date) AND (valued_on >= '2019-07-31'::date) AND (valued_on <= '2020-01-31'::date))
  • Rows Removed by Filter: 304054
18. 575.238 33,191.935 ↓ 1.2 1,418,452 1

Hash (cost=2,109,902.35..2,109,902.35 rows=1,148,120 width=119) (actual time=33,191.935..33,191.935 rows=1,418,452 loops=1)

  • Buckets: 65536 Batches: 4 Memory Usage: 56038kB
19. 2,983.907 32,616.697 ↓ 1.2 1,418,452 1

Hash Join (cost=1,861,300.45..2,109,902.35 rows=1,148,120 width=119) (actual time=24,442.304..32,616.697 rows=1,418,452 loops=1)

  • Hash Cond: (accounts_custodial_accounts_mvw.custodial_account_id = custodial_accounts.id)
20. 2,560.742 25,124.108 ↓ 1.2 1,418,452 1

Hash Join (cost=1,647,667.98..1,808,051.04 rows=1,148,120 width=96) (actual time=19,930.004..25,124.108 rows=1,418,452 loops=1)

  • Hash Cond: (accounts.account_forms_collection_id = account_forms_collections.id)
21. 2,295.188 12,755.298 ↑ 1.0 1,418,625 1

Hash Join (cost=330,139.71..425,494.75 rows=1,418,625 width=37) (actual time=10,118.397..12,755.298 rows=1,418,625 loops=1)

  • Hash Cond: (accounts_custodial_accounts_mvw.account_id = accounts.id)
22. 342.552 342.552 ↑ 1.0 1,418,625 1

Seq Scan on accounts_custodial_accounts_mvw (cost=0.00..32,819.82 rows=1,418,625 width=16) (actual time=0.010..342.552 rows=1,418,625 loops=1)

  • Filter: ((number)::text <> ''::text)
  • Rows Removed by Filter: 1
23. 791.199 10,117.558 ↓ 1.0 2,831,153 1

Hash (cost=272,727.87..272,727.87 rows=2,826,387 width=37) (actual time=10,117.558..10,117.558 rows=2,831,153 loops=1)

  • Buckets: 131072 Batches: 4 Memory Usage: 44266kB
24. 9,326.359 9,326.359 ↓ 1.0 2,831,153 1

Seq Scan on accounts (cost=0.00..272,727.87 rows=2,826,387 width=37) (actual time=0.621..9,326.359 rows=2,831,153 loops=1)

25. 460.998 9,808.068 ↓ 1.0 1,076,079 1

Hash (cost=1,290,446.45..1,290,446.45 rows=1,074,866 width=75) (actual time=9,808.068..9,808.068 rows=1,076,079 loops=1)

  • Buckets: 65536 Batches: 2 Memory Usage: 59128kB
26. 3,814.684 9,347.070 ↓ 1.0 1,076,079 1

Hash Join (cost=51,136.36..1,290,446.45 rows=1,074,866 width=75) (actual time=1,148.700..9,347.070 rows=1,076,079 loops=1)

  • Hash Cond: (contacts.id = account_forms_collections.contact_id)
27. 4,383.896 4,383.896 ↓ 1.0 1,725,536 1

Seq Scan on contacts (cost=0.00..1,202,960.37 rows=1,706,737 width=59) (actual time=0.012..4,383.896 rows=1,725,536 loops=1)

28. 424.392 1,148.490 ↑ 1.2 1,076,079 1

Hash (cost=34,795.05..34,795.05 rows=1,307,305 width=16) (actual time=1,148.490..1,148.490 rows=1,076,079 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 50442kB
29. 724.098 724.098 ↓ 1.0 1,307,579 1

Seq Scan on account_forms_collections (cost=0.00..34,795.05 rows=1,307,305 width=16) (actual time=0.005..724.098 rows=1,307,579 loops=1)

30. 1,187.744 4,508.682 ↓ 1.0 4,865,594 1

Hash (cost=128,052.54..128,052.54 rows=4,661,354 width=23) (actual time=4,508.682..4,508.682 rows=4,865,594 loops=1)

  • Buckets: 131072 Batches: 8 (originally 4) Memory Usage: 65537kB
31. 3,320.938 3,320.938 ↓ 1.0 4,865,594 1

Seq Scan on custodial_accounts (cost=0.00..128,052.54 rows=4,661,354 width=23) (actual time=0.671..3,320.938 rows=4,865,594 loops=1)

32. 144.124 387.566 ↓ 1.0 657,584 1

Hash (cost=22,426.53..22,426.53 rows=657,553 width=58) (actual time=387.566..387.566 rows=657,584 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 46743kB
33. 243.442 243.442 ↓ 1.0 657,584 1

Seq Scan on custodial_securities (cost=0.00..22,426.53 rows=657,553 width=58) (actual time=0.007..243.442 rows=657,584 loops=1)

34. 3.179 11.521 ↓ 1.0 25,102 1

Hash (cost=1,844.18..1,844.18 rows=25,018 width=24) (actual time=11.521..11.521 rows=25,102 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 1209kB
35. 8.342 8.342 ↓ 1.0 25,102 1

Seq Scan on classic_users owners_contacts_join (cost=0.00..1,844.18 rows=25,018 width=24) (actual time=0.005..8.342 rows=25,102 loops=1)

36. 0.003 3.849 ↑ 1.0 2 1

Hash (cost=55.58..55.58 rows=2 width=33) (actual time=3.849..3.849 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
37. 0.005 3.846 ↑ 1.0 2 1

Nested Loop Left Join (cost=0.98..55.58 rows=2 width=33) (actual time=3.833..3.846 rows=2 loops=1)

38. 0.005 1.017 ↑ 1.0 2 1

Nested Loop (cost=0.70..38.96 rows=2 width=25) (actual time=1.009..1.017 rows=2 loops=1)

39. 0.982 0.982 ↑ 1.0 2 1

Index Scan using index_rep_codes_on_classic_urn on rep_codes (cost=0.41..16.09 rows=2 width=25) (actual time=0.509..0.982 rows=2 loops=1)

  • Index Cond: ((classic_urn)::text = ANY ('{RepCode:cfs-back-office:C35,RepCode:cfs-registration:C35}'::text[]))
40. 0.030 0.030 ↑ 2.0 1 2

Index Scan using index_rep_code_mappings_on_rep_code_id on rep_code_mappings rep_code_mappings_contacts_join (cost=0.29..11.42 rows=2 width=16) (actual time=0.013..0.015 rows=1 loops=2)

  • Index Cond: (rep_code_id = rep_codes.id)
41. 2.824 2.824 ↑ 1.0 1 2

Index Scan using reps_pkey on reps (cost=0.29..8.30 rows=1 width=24) (actual time=1.412..1.412 rows=1 loops=2)

  • Index Cond: (id = rep_codes.rep_id)
42. 12.764 12.764 ↑ 1.0 1 3,191

Index Scan using contacts_pkey on contacts contacts_classic_users (cost=0.43..7.91 rows=1 width=23) (actual time=0.003..0.004 rows=1 loops=3,191)

  • Index Cond: (id = owners_contacts_join.contact_id)
43. 488.223 488.223 ↑ 1.0 1 3,191

Index Scan using custodial_securities_pkey on custodial_securities securities_custodial_latest_positions_mvw (cost=0.42..7.40 rows=1 width=16) (actual time=0.150..0.153 rows=1 loops=3,191)

  • Index Cond: (id = custodial_latest_positions_mvw.custodial_security_id)
44. 0.376 0.470 ↓ 1.0 521 1

Hash (cost=12.19..12.19 rows=519 width=24) (actual time=0.470..0.470 rows=521 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
45. 0.094 0.094 ↓ 1.0 521 1

Seq Scan on custodial_assets casset (cost=0.00..12.19 rows=519 width=24) (actual time=0.006..0.094 rows=521 loops=1)

46. 0.001 0.056 ↑ 1.0 1 1

Hash (cost=16.60..16.60 rows=1 width=42) (actual time=0.056..0.056 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
47. 0.004 0.055 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.55..16.60 rows=1 width=42) (actual time=0.054..0.055 rows=1 loops=1)

48. 0.036 0.036 ↑ 1.0 1 1

Index Scan using index_workgroups_on_classic_urn on workgroups (cost=0.28..8.29 rows=1 width=37) (actual time=0.036..0.036 rows=1 loops=1)

  • Index Cond: ((classic_urn)::text = 'Workgroup:cfs:RCF'::text)
49. 0.015 0.015 ↑ 1.0 1 1

Index Scan using index_programs_on_workgroup_id on programs (cost=0.28..8.29 rows=1 width=13) (actual time=0.014..0.015 rows=1 loops=1)

  • Index Cond: (workgroup_id = workgroups.id)
50. 0.000 3.191 ↓ 0.0 0 3,191

Nested Loop (cost=0.29..6.77 rows=1 width=38) (actual time=0.001..0.001 rows=0 loops=3,191)

51. 3.191 3.191 ↓ 0.0 0 3,191

Index Scan using index_on_cus_cost_basis_acc_sec_and_portf_acc_type on custodial_cost_basis_summaries (cost=0.14..3.36 rows=1 width=24) (actual time=0.001..0.001 rows=0 loops=3,191)

  • Index Cond: (custodial_accounts.id = custodial_account_id)
52. 0.000 0.000 ↓ 0.0 0

Index Scan using index_on_cost_basis_record_identifier on custodial_cost_basis_details (cost=0.15..3.40 rows=1 width=30) (never executed)

  • Index Cond: (custodial_cost_basis_summary_id = custodial_cost_basis_summaries.id)
53. 12.764 12.764 ↑ 1.0 1 3,191

Index Scan using held_wheres_pkey on held_wheres (cost=0.28..6.73 rows=1 width=29) (actual time=0.003..0.004 rows=1 loops=3,191)

  • Index Cond: (id = accounts.held_where_id)
54. 3.191 3.191 ↑ 1.0 10 3,191

Seq Scan on custodial_asset_classes (cost=0.00..1.10 rows=10 width=19) (actual time=0.001..0.001 rows=10 loops=3,191)

55. 6.382 6.382 ↑ 1.0 1 3,191

Index Scan using custodial_asset_product_subgroups_pkey on custodial_asset_product_subgroups (cost=0.14..2.17 rows=1 width=25) (actual time=0.002..0.002 rows=1 loops=3,191)

  • Index Cond: (id = casset.custodial_asset_product_subgroup_id)
56. 890.289 890.289 ↑ 1.0 1 3,191

Index Scan using custodial_account_id_contacts_mvbalances_mvw on contacts_mvbalances_mvw (cost=0.43..7.40 rows=1 width=35) (actual time=0.275..0.279 rows=1 loops=3,191)

  • Index Cond: (custodial_account_id = accounts_custodial_accounts_mvw.custodial_account_id)
57. 48.060 48.060 ↑ 1.0 1 3,204

Index Scan using contacts_pkey on contacts contacts_1 (cost=0.43..7.44 rows=1 width=8) (actual time=0.015..0.015 rows=1 loops=3,204)

  • Index Cond: (id = contacts.id)
  • Filter: (realm_id = ANY ('{1,2,5,7,3,4}'::integer[]))
Planning time : 49.797 ms
Execution time : 41,324.931 ms