explain.depesz.com

PostgreSQL's explain analyze made readable

Result: fzX

Settings
# exclusive inclusive rows x rows loops node
1. 3.922 32,609.395 ↓ 3,378.0 3,378 1

WindowAgg (cost=2,425,551.75..2,425,551.79 rows=1 width=315) (actual time=32,603.356..32,609.395 rows=3,378 loops=1)

2. 10.577 32,605.473 ↓ 3,378.0 3,378 1

HashAggregate (cost=2,425,551.75..2,425,551.77 rows=1 width=315) (actual time=32,603.337..32,605.473 rows=3,378 loops=1)

  • Group Key: custodial_securities.cusip, custodial_securities.fund, custodial_securities.sub_fund, programs.program_type, w1.name, w1.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. 2.374 32,594.896 ↓ 3,386.0 3,386 1

Nested Loop Semi Join (cost=2,179,041.19..2,425,551.67 rows=1 width=315) (actual time=27,839.893..32,594.896 rows=3,386 loops=1)

  • Join Filter: (account_forms_collections.contact_id = contacts_1.id)
4. 2.321 32,582.364 ↓ 3,386.0 3,386 1

Nested Loop Left Join (cost=2,179,040.76..2,425,544.22 rows=1 width=331) (actual time=27,839.880..32,582.364 rows=3,386 loops=1)

5. 2.743 32,569.924 ↓ 3,373.0 3,373 1

Nested Loop Left Join (cost=2,179,040.33..2,425,536.81 rows=1 width=312) (actual time=27,839.864..32,569.924 rows=3,373 loops=1)

6. 6.338 32,563.808 ↓ 3,373.0 3,373 1

Nested Loop Left Join (cost=2,179,040.19..2,425,534.63 rows=1 width=295) (actual time=27,839.857..32,563.808 rows=3,373 loops=1)

  • Join Filter: (custodial_asset_classes.id = custodial_assets.custodial_asset_class_id)
  • Rows Removed by Join Filter: 30,357
7. 1.256 32,554.097 ↓ 3,373.0 3,373 1

Nested Loop Left Join (cost=2,179,040.19..2,425,533.41 rows=1 width=284) (actual time=27,839.850..32,554.097 rows=3,373 loops=1)

8. 1.279 32,546.095 ↓ 3,373.0 3,373 1

Nested Loop Left Join (cost=2,179,039.91..2,425,526.67 rows=1 width=263) (actual time=27,839.835..32,546.095 rows=3,373 loops=1)

  • Join Filter: (custodial_securities.id = custodial_cost_basis_summaries.custodial_security_id)
9. 1.808 32,541.443 ↓ 3,373.0 3,373 1

Hash Join (cost=2,179,039.62..2,425,519.89 rows=1 width=257) (actual time=27,839.828..32,541.443 rows=3,373 loops=1)

  • Hash Cond: (owners_contacts_join.workgroup_id = w1.id)
10. 1.865 32,539.028 ↓ 27.2 3,373 1

Hash Left Join (cost=2,179,023.01..2,425,502.80 rows=124 width=231) (actual time=27,839.207..32,539.028 rows=3,373 loops=1)

  • Hash Cond: (securities_custodial_latest_positions_mvw.custodial_asset_id = custodial_assets.id)
11. 1.945 32,537.004 ↓ 27.2 3,373 1

Nested Loop Left Join (cost=2,179,004.33..2,425,482.42 rows=124 width=223) (actual time=27,839.039..32,537.004 rows=3,373 loops=1)

12. 2.501 32,518.194 ↓ 27.2 3,373 1

Nested Loop (cost=2,179,003.91..2,424,563.94 rows=124 width=223) (actual time=27,839.027..32,518.194 rows=3,373 loops=1)

13. 122.994 32,505.574 ↓ 15.8 3,373 1

Hash Join (cost=2,179,003.48..2,422,868.01 rows=214 width=208) (actual time=27,839.011..32,505.574 rows=3,373 loops=1)

  • Hash Cond: (contacts.rep_code_mapping_id = rep_code_mappings_contacts_join.id)
14. 602.876 32,382.457 ↑ 1.3 1,831,138 1

Hash Join (cost=2,178,947.87..2,413,911.21 rows=2,373,179 width=191) (actual time=27,746.290..32,382.457 rows=1,831,138 loops=1)

  • Hash Cond: (contacts.owner_id = owners_contacts_join.id)
15. 1,153.518 31,756.734 ↑ 1.3 1,831,138 1

Hash Join (cost=2,176,790.96..2,364,249.51 rows=2,377,300 width=183) (actual time=27,723.415..31,756.734 rows=1,831,138 loops=1)

  • Hash Cond: (custodial_latest_positions_mvw.custodial_security_id = custodial_securities.id)
16. 2,407.727 30,110.909 ↑ 1.3 1,836,839 1

Hash Join (cost=2,146,141.78..2,288,975.21 rows=2,383,099 width=126) (actual time=27,230.633..30,110.909 rows=1,836,839 loops=1)

  • Hash Cond: (custodial_latest_positions_mvw.custodial_account_id = custodial_accounts.id)
17. 473.084 473.084 ↓ 1.0 2,903,591 1

Seq Scan on custodial_latest_positions_mvw (cost=0.00..65,605.91 rows=2,902,791 width=16) (actual time=0.003..473.084 rows=2,903,591 loops=1)

18. 606.444 27,230.098 ↓ 1.2 1,418,395 1

Hash (cost=2,111,542.07..2,111,542.07 rows=1,150,297 width=118) (actual time=27,230.098..27,230.098 rows=1,418,395 loops=1)

  • Buckets: 65,536 Batches: 4 Memory Usage: 56,035kB
19. 2,566.575 26,623.654 ↓ 1.2 1,418,395 1

Hash Join (cost=1,867,343.18..2,111,542.07 rows=1,150,297 width=118) (actual time=19,342.027..26,623.654 rows=1,418,395 loops=1)

  • Hash Cond: (accounts_custodial_accounts_mvw.custodial_account_id = custodial_accounts.id)
20. 2,314.221 22,151.134 ↓ 1.2 1,418,395 1

Hash Join (cost=1,648,419.26..1,808,942.08 rows=1,150,297 width=95) (actual time=17,435.510..22,151.134 rows=1,418,395 loops=1)

  • Hash Cond: (accounts.account_forms_collection_id = account_forms_collections.id)
21. 2,091.520 5,700.524 ↑ 1.0 1,418,568 1

Hash Join (cost=330,597.46..426,070.50 rows=1,418,625 width=36) (actual time=3,298.766..5,700.524 rows=1,418,568 loops=1)

  • Hash Cond: (accounts_custodial_accounts_mvw.account_id = accounts.id)
22. 310.720 310.720 ↑ 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.011..310.720 rows=1,418,625 loops=1)

  • Filter: ((number)::text <> ''::text)
  • Rows Removed by Filter: 1
23. 749.179 3,298.284 ↑ 1.0 2,831,208 1

Hash (cost=272,878.87..272,878.87 rows=2,841,487 width=36) (actual time=3,298.284..3,298.284 rows=2,831,208 loops=1)

  • Buckets: 131,072 Batches: 4 Memory Usage: 44,266kB
24. 2,549.105 2,549.105 ↑ 1.0 2,831,208 1

Seq Scan on accounts (cost=0.00..272,878.87 rows=2,841,487 width=36) (actual time=0.012..2,549.105 rows=2,831,208 loops=1)

25. 466.799 14,136.389 ↓ 1.0 1,076,079 1

Hash (cost=1,290,739.97..1,290,739.97 rows=1,074,866 width=75) (actual time=14,136.389..14,136.389 rows=1,076,079 loops=1)

  • Buckets: 65,536 Batches: 2 Memory Usage: 59,128kB
26. 3,726.966 13,669.590 ↓ 1.0 1,076,079 1

Hash Join (cost=51,136.36..1,290,739.97 rows=1,074,866 width=75) (actual time=462.105..13,669.590 rows=1,076,079 loops=1)

  • Hash Cond: (contacts.id = account_forms_collections.contact_id)
27. 9,481.336 9,481.336 ↓ 1.0 1,725,538 1

Seq Scan on contacts (cost=0.00..1,203,077.78 rows=1,718,478 width=59) (actual time=0.038..9,481.336 rows=1,725,538 loops=1)

28. 214.383 461.288 ↑ 1.2 1,076,079 1

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

  • Buckets: 131,072 Batches: 1 Memory Usage: 50,442kB
29. 246.905 246.905 ↓ 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..246.905 rows=1,307,579 loops=1)

30. 878.071 1,905.945 ↓ 1.0 4,867,215 1

Hash (cost=129,918.52..129,918.52 rows=4,847,952 width=23) (actual time=1,905.945..1,905.945 rows=4,867,215 loops=1)

  • Buckets: 131,072 Batches: 8 Memory Usage: 33,865kB
31. 1,027.874 1,027.874 ↓ 1.0 4,867,215 1

Seq Scan on custodial_accounts (cost=0.00..129,918.52 rows=4,847,952 width=23) (actual time=0.004..1,027.874 rows=4,867,215 loops=1)

32. 353.198 492.307 ↓ 1.0 657,713 1

Hash (cost=22,427.97..22,427.97 rows=657,697 width=57) (actual time=492.307..492.307 rows=657,713 loops=1)

  • Buckets: 131,072 Batches: 1 Memory Usage: 46,754kB
33. 139.109 139.109 ↓ 1.0 657,713 1

Seq Scan on custodial_securities (cost=0.00..22,427.97 rows=657,697 width=57) (actual time=0.005..139.109 rows=657,713 loops=1)

34. 4.468 22.847 ↓ 1.0 25,104 1

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

  • Buckets: 4,096 Batches: 1 Memory Usage: 1,209kB
35. 18.379 18.379 ↓ 1.0 25,104 1

Seq Scan on classic_users owners_contacts_join (cost=0.00..1,844.18 rows=25,018 width=24) (actual time=0.016..18.379 rows=25,104 loops=1)

36. 0.002 0.123 ↑ 1.0 2 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
37. 0.002 0.121 ↑ 1.0 2 1

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

38. 0.002 0.111 ↑ 1.0 2 1

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

39. 0.079 0.079 ↑ 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.045..0.079 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.011..0.015 rows=1 loops=2)

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

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

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

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

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

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.005..0.005 rows=1 loops=3,373)

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

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 29kB
45. 0.083 0.083 ↓ 1.0 521 1

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

46. 0.002 0.607 ↑ 1.0 1 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
47. 0.004 0.605 ↑ 1.0 1 1

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

48. 0.041 0.041 ↑ 1.0 1 1

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

  • Index Cond: ((classic_urn)::text = 'Workgroup:cfs:RCF'::text)
49. 0.560 0.560 ↑ 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.559..0.560 rows=1 loops=1)

  • Index Cond: (workgroup_id = w1.id)
50. 0.000 3.373 ↓ 0.0 0 3,373

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

51. 3.373 3.373 ↓ 0.0 0 3,373

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,373)

  • 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. 6.746 6.746 ↑ 1.0 1 3,373

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

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

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

55. 3.373 3.373 ↑ 1.0 1 3,373

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.001..0.001 rows=1 loops=3,373)

  • Index Cond: (id = custodial_assets.custodial_asset_product_subgroup_id)
56. 10.119 10.119 ↑ 1.0 1 3,373

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.003..0.003 rows=1 loops=3,373)

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

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

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