explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uxDA

Settings
# exclusive inclusive rows x rows loops node
1. 4.426 74,355.785 ↓ 3,378.0 3,378 1

WindowAgg (cost=2,425,551.75..2,425,551.79 rows=1 width=315) (actual time=74,349.908..74,355.785 rows=3,378 loops=1)

2. 10.758 74,351.359 ↓ 3,378.0 3,378 1

HashAggregate (cost=2,425,551.75..2,425,551.77 rows=1 width=315) (actual time=74,349.329..74,351.359 rows=3,378 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.485 74,340.601 ↓ 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=68,629.070..74,340.601 rows=3,386 loops=1)

  • Join Filter: (account_forms_collections.contact_id = contacts_1.id)
4. 1.085 74,251.466 ↓ 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=68,629.037..74,251.466 rows=3,386 loops=1)

5. 0.670 73,680.344 ↓ 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=68,627.862..73,680.344 rows=3,373 loops=1)

6. 6.974 73,672.928 ↓ 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=68,627.852..73,672.928 rows=3,373 loops=1)

  • Join Filter: (custodial_asset_classes.id = custodial_assets.custodial_asset_class_id)
  • Rows Removed by Join Filter: 30357
7. 1.415 73,662.581 ↓ 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=68,627.843..73,662.581 rows=3,373 loops=1)

8. 1.609 73,654.420 ↓ 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=68,627.831..73,654.420 rows=3,373 loops=1)

  • Join Filter: (custodial_securities.id = custodial_cost_basis_summaries.custodial_security_id)
9. 1.811 73,649.438 ↓ 3,373.0 3,373 1

Hash Join (cost=2,179,039.62..2,425,519.89 rows=1 width=257) (actual time=68,627.820..73,649.438 rows=3,373 loops=1)

  • Hash Cond: (owners_contacts_join.workgroup_id = workgroups.id)
10. 2.055 73,646.614 ↓ 27.2 3,373 1

Hash Left Join (cost=2,179,023.01..2,425,502.80 rows=124 width=231) (actual time=68,626.793..73,646.614 rows=3,373 loops=1)

  • Hash Cond: (securities_custodial_latest_positions_mvw.custodial_asset_id = custodial_assets.id)
11. 1.608 73,644.387 ↓ 27.2 3,373 1

Nested Loop Left Join (cost=2,179,004.33..2,425,482.42 rows=124 width=223) (actual time=68,626.601..73,644.387 rows=3,373 loops=1)

12. 3.625 73,460.637 ↓ 27.2 3,373 1

Nested Loop (cost=2,179,003.91..2,424,563.94 rows=124 width=223) (actual time=68,626.584..73,460.637 rows=3,373 loops=1)

13. 120.075 73,446.893 ↓ 15.8 3,373 1

Hash Join (cost=2,179,003.48..2,422,868.01 rows=214 width=208) (actual time=68,626.542..73,446.893 rows=3,373 loops=1)

  • Hash Cond: (contacts.rep_code_mapping_id = rep_code_mappings_contacts_join.id)
14. 583.160 73,320.077 ↑ 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=68,501.244..73,320.077 rows=1,831,138 loops=1)

  • Hash Cond: (contacts.owner_id = owners_contacts_join.id)
15. 1,087.112 72,671.938 ↑ 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=68,436.224..72,671.938 rows=1,831,138 loops=1)

  • Hash Cond: (custodial_latest_positions_mvw.custodial_security_id = custodial_securities.id)
16. 2,341.820 71,230.988 ↑ 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=68,081.949..71,230.988 rows=1,836,839 loops=1)

  • Hash Cond: (custodial_latest_positions_mvw.custodial_account_id = custodial_accounts.id)
17. 808.755 808.755 ↓ 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.004..808.755 rows=2,903,591 loops=1)

18. 575.421 68,080.413 ↓ 1.2 1,418,395 1

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

  • Buckets: 65536 Batches: 4 Memory Usage: 56035kB
19. 2,544.532 67,504.992 ↓ 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=60,384.754..67,504.992 rows=1,418,395 loops=1)

  • Hash Cond: (accounts_custodial_accounts_mvw.custodial_account_id = custodial_accounts.id)
20. 2,183.738 62,144.798 ↓ 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=57,568.523..62,144.798 rows=1,418,395 loops=1)

  • Hash Cond: (accounts.account_forms_collection_id = account_forms_collections.id)
21. 2,076.925 11,379.310 ↑ 1.0 1,418,568 1

Hash Join (cost=330,597.46..426,070.50 rows=1,418,625 width=36) (actual time=8,986.375..11,379.310 rows=1,418,568 loops=1)

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

  • Filter: ((number)::text <> ''::text)
  • Rows Removed by Filter: 1
23. 877.399 8,985.862 ↑ 1.0 2,831,207 1

Hash (cost=272,878.87..272,878.87 rows=2,841,487 width=36) (actual time=8,985.862..8,985.862 rows=2,831,207 loops=1)

  • Buckets: 131072 Batches: 4 Memory Usage: 44266kB
24. 8,108.463 8,108.463 ↑ 1.0 2,831,207 1

Seq Scan on accounts (cost=0.00..272,878.87 rows=2,841,487 width=36) (actual time=0.016..8,108.463 rows=2,831,207 loops=1)

25. 886.263 48,581.750 ↓ 1.0 1,076,079 1

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

  • Buckets: 65536 Batches: 2 Memory Usage: 59128kB
26. 5,356.761 47,695.487 ↓ 1.0 1,076,079 1

Hash Join (cost=51,136.36..1,290,739.97 rows=1,074,866 width=75) (actual time=753.010..47,695.487 rows=1,076,079 loops=1)

  • Hash Cond: (contacts.id = account_forms_collections.contact_id)
27. 41,590.748 41,590.748 ↓ 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=1.946..41,590.748 rows=1,725,538 loops=1)

28. 231.002 747.978 ↑ 1.2 1,076,079 1

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

  • Buckets: 131072 Batches: 1 Memory Usage: 50442kB
29. 516.976 516.976 ↓ 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.013..516.976 rows=1,307,579 loops=1)

30. 1,007.211 2,815.662 ↓ 1.0 4,867,152 1

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

  • Buckets: 131072 Batches: 8 Memory Usage: 33865kB
31. 1,808.451 1,808.451 ↓ 1.0 4,867,152 1

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

32. 163.614 353.838 ↓ 1.0 657,699 1

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

  • Buckets: 131072 Batches: 1 Memory Usage: 46753kB
33. 190.224 190.224 ↓ 1.0 657,699 1

Seq Scan on custodial_securities (cost=0.00..22,427.97 rows=657,697 width=57) (actual time=0.019..190.224 rows=657,699 loops=1)

34. 4.601 64.979 ↓ 1.0 25,104 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 1209kB
35. 60.378 60.378 ↓ 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=1.167..60.378 rows=25,104 loops=1)

36. 0.005 6.741 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
37. 0.004 6.736 ↑ 1.0 2 1

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

38. 0.005 6.698 ↑ 1.0 2 1

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

39. 6.641 6.641 ↑ 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=6.108..6.641 rows=2 loops=1)

  • Index Cond: ((classic_urn)::text = ANY ('{RepCode:cfs-back-office:C35,RepCode:cfs-registration:C35}'::text[]))
40. 0.052 0.052 ↑ 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.021..0.026 rows=1 loops=2)

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

Index Scan using reps_pkey on reps (cost=0.29..8.30 rows=1 width=24) (actual time=0.017..0.017 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.003..0.003 rows=1 loops=3,373)

  • Index Cond: (id = owners_contacts_join.contact_id)
43. 182.142 182.142 ↑ 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.053..0.054 rows=1 loops=3,373)

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

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

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

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

46. 0.004 1.013 ↑ 1.0 1 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
47. 0.008 1.009 ↑ 1.0 1 1

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

48. 0.872 0.872 ↑ 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.872..0.872 rows=1 loops=1)

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

  • Index Cond: (workgroup_id = workgroups.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. 6.746 6.746 ↑ 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.002 rows=1 loops=3,373)

  • Index Cond: (id = custodial_assets.custodial_asset_product_subgroup_id)
56. 570.037 570.037 ↑ 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.168..0.169 rows=1 loops=3,373)

  • Index Cond: (custodial_account_id = accounts_custodial_accounts_mvw.custodial_account_id)
57. 84.650 84.650 ↑ 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.025..0.025 rows=1 loops=3,386)

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