explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 8TQH

Settings
# exclusive inclusive rows x rows loops node
1. 40.549 5,543.875 ↓ 8.6 6,617 1

Nested Loop Left Join (cost=396,805.81..431,049.81 rows=769 width=640) (actual time=4,711.324..5,543.875 rows=6,617 loops=1)

2. 6.353 5,198.944 ↓ 8.6 6,617 1

Hash Left Join (cost=396,805.25..415,791.18 rows=769 width=520) (actual time=4,711.167..5,198.944 rows=6,617 loops=1)

  • Hash Cond: (own_ent_funds.fund_type = fund_type_map.fund_type_code)
3. 5.949 5,192.562 ↓ 8.6 6,617 1

Hash Left Join (cost=396,803.82..415,779.18 rows=769 width=456) (actual time=4,711.128..5,192.562 rows=6,617 loops=1)

  • Hash Cond: (ent_entity_metro_areas.metro_id = metro_map.metro_code)
4. 10.861 5,186.405 ↓ 8.6 6,617 1

Nested Loop Left Join (cost=396,797.66..415,762.45 rows=769 width=440) (actual time=4,710.903..5,186.405 rows=6,617 loops=1)

5. 5.939 5,115.991 ↓ 8.6 6,617 1

Hash Left Join (cost=396,797.23..415,398.98 rows=769 width=445) (actual time=4,710.879..5,115.991 rows=6,617 loops=1)

  • Hash Cond: (country_map.region_code = region_map.region_code)
6. 6.453 5,110.036 ↓ 8.6 6,617 1

Hash Left Join (cost=396,796.05..415,387.23 rows=769 width=379) (actual time=4,710.853..5,110.036 rows=6,617 loops=1)

  • Hash Cond: (fund_entity.iso_country = country_map.iso_country)
7. 8.307 5,103.254 ↓ 8.6 6,617 1

Nested Loop Left Join (cost=396,787.97..415,368.58 rows=769 width=367) (actual time=4,710.510..5,103.254 rows=6,617 loops=1)

8. 10.950 5,035.394 ↓ 8.6 6,617 1

Nested Loop Left Join (cost=396,787.55..410,082.37 rows=769 width=326) (actual time=4,710.485..5,035.394 rows=6,617 loops=1)

9. 10.715 4,964.891 ↓ 8.6 6,617 1

Nested Loop Left Join (cost=396,787.12..408,410.16 rows=769 width=307) (actual time=4,710.462..4,964.891 rows=6,617 loops=1)

10. 6.276 4,894.623 ↓ 8.6 6,617 1

Nested Loop Left Join (cost=396,786.69..405,182.62 rows=769 width=276) (actual time=4,710.441..4,894.623 rows=6,617 loops=1)

11. 8.782 4,822.177 ↓ 8.6 6,617 1

Hash Left Join (cost=396,786.26..401,955.07 rows=769 width=239) (actual time=4,710.411..4,822.177 rows=6,617 loops=1)

  • Hash Cond: (current_factset_fund_holdings.factset_fund_id = q4_fund_values.factset_fund_id)
12. 6.990 4,756.149 ↓ 8.6 6,617 1

Nested Loop Left Join (cost=394,430.00..399,588.24 rows=769 width=223) (actual time=4,653.080..4,756.149 rows=6,617 loops=1)

13. 15.079 4,689.606 ↓ 8.6 6,617 1

Merge Left Join (cost=394,429.59..394,450.35 rows=769 width=192) (actual time=4,653.056..4,689.606 rows=6,617 loops=1)

  • Merge Cond: ((current_factset_fund_holdings.fsym_id = factset_prev_fund_holdings.fsym_id) AND (current_factset_fund_holdings.factset_fund_id = factset_prev_fund_holdings.factset_fund_id))
14.          

CTE factset_fund_holdings

15. 104.285 2,311.767 ↑ 2.0 77,625 1

WindowAgg (cost=189,243.11..193,454.58 rows=153,788 width=46) (actual time=2,002.829..2,311.767 rows=77,625 loops=1)

16. 126.260 2,207.482 ↑ 2.0 77,625 1

Merge Left Join (cost=189,243.11..190,763.29 rows=153,788 width=54) (actual time=2,002.821..2,207.482 rows=77,625 loops=1)

  • Merge Cond: ((own_fund_detail.factset_fund_id = adjh.factset_fund_id) AND (ad.report_date = adjh.report_date))
  • Join Filter: (adjh.fsym_id = sar.fsym_id)
17. 216.211 1,012.910 ↑ 2.0 77,625 1

Sort (cost=115,291.30..115,675.77 rows=153,788 width=46) (actual time=982.397..1,012.910 rows=77,625 loops=1)

  • Sort Key: own_fund_detail.factset_fund_id, ad.report_date DESC
  • Sort Method: quicksort Memory: 13973kB
18. 70.367 796.699 ↑ 2.0 77,625 1

Nested Loop (cost=77,017.22..102,042.02 rows=153,788 width=46) (actual time=423.229..796.699 rows=77,625 loops=1)

  • Join Filter: (own_fund_detail.factset_fund_id = ad.factset_fund_id)
19. 5.336 571.542 ↑ 1.6 6,730 1

Nested Loop (cost=77,016.79..77,592.30 rows=10,739 width=51) (actual time=423.191..571.542 rows=6,730 loops=1)

20. 0.021 0.021 ↑ 1.0 1 1

Index Only Scan using own_sec_coverage_fsym_id_idx on own_sec_coverage sar (cost=0.42..8.44 rows=1 width=9) (actual time=0.019..0.021 rows=1 loops=1)

  • Index Cond: (fsym_id = 'BHM9TN-S'::bpchar)
  • Heap Fetches: 1
21. 11.459 566.185 ↑ 1.6 6,730 1

Hash Join (cost=77,016.37..77,476.47 rows=10,739 width=51) (actual time=423.170..566.185 rows=6,730 loops=1)

  • Hash Cond: (own_fund_detail.factset_fund_id = ent.factset_fund_id)
22. 67.222 466.723 ↑ 2.4 7,979 1

Unique (cost=72,099.09..72,193.17 rows=18,809 width=54) (actual time=334.777..466.723 rows=7,979 loops=1)

23. 306.744 399.501 ↓ 7.6 143,529 1

Sort (cost=72,099.09..72,146.13 rows=18,816 width=54) (actual time=334.775..399.501 rows=143,529 loops=1)

  • Sort Key: own_fund_detail.factset_fund_id
  • Sort Method: quicksort Memory: 17358kB
24. 75.746 92.757 ↓ 7.6 143,529 1

Bitmap Heap Scan on own_fund_detail (cost=442.39..70,763.18 rows=18,816 width=54) (actual time=19.177..92.757 rows=143,529 loops=1)

  • Recheck Cond: (fsym_id = 'BHM9TN-S'::bpchar)
  • Heap Blocks: exact=13494
25. 17.011 17.011 ↓ 7.7 144,981 1

Bitmap Index Scan on own_fund_detail_fsym_id_report_date_idx (cost=0.00..437.69 rows=18,816 width=0) (actual time=17.011..17.011 rows=144,981 loops=1)

  • Index Cond: (fsym_id = 'BHM9TN-S'::bpchar)
26. 30.655 88.003 ↓ 1.0 68,140 1

Hash (cost=4,065.65..4,065.65 rows=68,131 width=9) (actual time=88.002..88.003 rows=68,140 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 3753kB
27. 57.348 57.348 ↓ 1.0 68,140 1

Seq Scan on own_ent_funds ent (cost=0.00..4,065.65 rows=68,131 width=9) (actual time=0.012..57.348 rows=68,140 loops=1)

  • Filter: (active_flag = 1)
  • Rows Removed by Filter: 51192
28. 154.790 154.790 ↑ 1.2 12 6,730

Index Only Scan using q4_fund_dates_pkey on q4_fund_dates ad (cost=0.43..2.10 rows=14 width=13) (actual time=0.015..0.023 rows=12 loops=6,730)

  • Index Cond: ((factset_fund_id = ent.factset_fund_id) AND (report_date >= '2017-06-10'::date) AND (report_date <= '2019-06-10'::date) AND (report_date >= '2017-06-10'::date) AND (report_date <= '2019-06-10'::date))
  • Heap Fetches: 77625
29. 259.287 1,068.312 ↓ 7.6 143,529 1

Sort (cost=73,951.81..73,998.84 rows=18,809 width=30) (actual time=1,020.412..1,068.312 rows=143,529 loops=1)

  • Sort Key: adjh.factset_fund_id, adjh.report_date DESC
  • Sort Method: quicksort Memory: 17358kB
30. 85.478 809.025 ↓ 7.6 143,529 1

Subquery Scan on adjh (cost=72,099.09..72,616.46 rows=18,809 width=30) (actual time=569.872..809.025 rows=143,529 loops=1)

31. 102.236 723.547 ↓ 7.6 143,529 1

Unique (cost=72,099.09..72,428.37 rows=18,809 width=54) (actual time=569.870..723.547 rows=143,529 loops=1)

32. 516.885 621.311 ↓ 7.6 143,529 1

Sort (cost=72,099.09..72,146.13 rows=18,816 width=54) (actual time=569.868..621.311 rows=143,529 loops=1)

  • Sort Key: own_fund_detail_1.factset_fund_id, own_fund_detail_1.adj_holding, own_fund_detail_1.report_date, own_fund_detail_1.reported_holding, own_fund_detail_1.adj_mv, own_fund_detail_1.reported_mv
  • Sort Method: quicksort Memory: 26321kB
33. 78.388 104.426 ↓ 7.6 143,529 1

Bitmap Heap Scan on own_fund_detail own_fund_detail_1 (cost=442.39..70,763.18 rows=18,816 width=54) (actual time=28.794..104.426 rows=143,529 loops=1)

  • Recheck Cond: (fsym_id = 'BHM9TN-S'::bpchar)
  • Heap Blocks: exact=13494
34. 26.038 26.038 ↓ 7.7 144,981 1

Bitmap Index Scan on own_fund_detail_fsym_id_report_date_idx (cost=0.00..437.69 rows=18,816 width=0) (actual time=26.038..26.038 rows=144,981 loops=1)

  • Index Cond: (fsym_id = 'BHM9TN-S'::bpchar)
35.          

CTE factset_prev_fund_holdings

36. 74.908 2,201.174 ↑ 2.1 64,435 1

WindowAgg (cost=187,152.43..190,890.79 rows=135,913 width=46) (actual time=1,956.643..2,201.174 rows=64,435 loops=1)

37. 103.381 2,126.266 ↑ 2.1 64,435 1

Merge Left Join (cost=187,152.43..188,512.31 rows=135,913 width=54) (actual time=1,956.633..2,126.266 rows=64,435 loops=1)

  • Merge Cond: ((own_fund_detail_2.factset_fund_id = adjh_1.factset_fund_id) AND (ad_1.report_date = adjh_1.report_date))
  • Join Filter: (adjh_1.fsym_id = sar_1.fsym_id)
38. 152.713 765.767 ↑ 2.1 64,435 1

Sort (cost=113,200.62..113,540.40 rows=135,913 width=46) (actual time=743.636..765.767 rows=64,435 loops=1)

  • Sort Key: own_fund_detail_2.factset_fund_id, ad_1.report_date DESC
  • Sort Method: quicksort Memory: 10592kB
39. 34.119 613.054 ↑ 2.1 64,435 1

Nested Loop (cost=77,017.22..101,612.46 rows=135,913 width=46) (actual time=406.565..613.054 rows=64,435 loops=1)

  • Join Filter: (own_fund_detail_2.factset_fund_id = ad_1.factset_fund_id)
40. 3.210 491.445 ↑ 1.6 6,730 1

Nested Loop (cost=77,016.79..77,592.30 rows=10,739 width=51) (actual time=406.532..491.445 rows=6,730 loops=1)

41. 0.023 0.023 ↑ 1.0 1 1

Index Only Scan using own_sec_coverage_fsym_id_idx on own_sec_coverage sar_1 (cost=0.42..8.44 rows=1 width=9) (actual time=0.022..0.023 rows=1 loops=1)

  • Index Cond: (fsym_id = 'BHM9TN-S'::bpchar)
  • Heap Fetches: 1
42. 11.650 488.212 ↑ 1.6 6,730 1

Hash Join (cost=77,016.37..77,476.47 rows=10,739 width=51) (actual time=406.507..488.212 rows=6,730 loops=1)

  • Hash Cond: (own_fund_detail_2.factset_fund_id = ent_1.factset_fund_id)
43. 36.541 374.551 ↑ 2.4 7,979 1

Unique (cost=72,099.09..72,193.17 rows=18,809 width=54) (actual time=299.927..374.551 rows=7,979 loops=1)

44. 255.305 338.010 ↓ 7.6 143,529 1

Sort (cost=72,099.09..72,146.13 rows=18,816 width=54) (actual time=299.926..338.010 rows=143,529 loops=1)

  • Sort Key: own_fund_detail_2.factset_fund_id
  • Sort Method: quicksort Memory: 17358kB
45. 65.678 82.705 ↓ 7.6 143,529 1

Bitmap Heap Scan on own_fund_detail own_fund_detail_2 (cost=442.39..70,763.18 rows=18,816 width=54) (actual time=19.191..82.705 rows=143,529 loops=1)

  • Recheck Cond: (fsym_id = 'BHM9TN-S'::bpchar)
  • Heap Blocks: exact=13494
46. 17.027 17.027 ↓ 7.7 144,981 1

Bitmap Index Scan on own_fund_detail_fsym_id_report_date_idx (cost=0.00..437.69 rows=18,816 width=0) (actual time=17.027..17.027 rows=144,981 loops=1)

  • Index Cond: (fsym_id = 'BHM9TN-S'::bpchar)
47. 35.035 102.011 ↓ 1.0 68,140 1

Hash (cost=4,065.65..4,065.65 rows=68,131 width=9) (actual time=102.010..102.011 rows=68,140 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 3753kB
48. 66.976 66.976 ↓ 1.0 68,140 1

Seq Scan on own_ent_funds ent_1 (cost=0.00..4,065.65 rows=68,131 width=9) (actual time=0.014..66.976 rows=68,140 loops=1)

  • Filter: (active_flag = 1)
  • Rows Removed by Filter: 51192
49. 87.490 87.490 ↑ 1.3 10 6,730

Index Only Scan using q4_fund_dates_pkey on q4_fund_dates ad_1 (cost=0.43..2.07 rows=13 width=13) (actual time=0.009..0.013 rows=10 loops=6,730)

  • Index Cond: ((factset_fund_id = ent_1.factset_fund_id) AND (report_date >= '2017-06-10'::date) AND (report_date <= '2019-06-10'::date) AND (report_date >= '2016-12-31'::date) AND (report_date <= '2018-12-31'::date))
  • Heap Fetches: 64435
50. 416.425 1,257.118 ↓ 7.6 143,529 1

Sort (cost=73,951.81..73,998.84 rows=18,809 width=30) (actual time=1,212.980..1,257.118 rows=143,529 loops=1)

  • Sort Key: adjh_1.factset_fund_id, adjh_1.report_date DESC
  • Sort Method: quicksort Memory: 17358kB
51. 114.910 840.693 ↓ 7.6 143,529 1

Subquery Scan on adjh_1 (cost=72,099.09..72,616.46 rows=18,809 width=30) (actual time=519.544..840.693 rows=143,529 loops=1)

52. 136.448 725.783 ↓ 7.6 143,529 1

Unique (cost=72,099.09..72,428.37 rows=18,809 width=54) (actual time=519.542..725.783 rows=143,529 loops=1)

53. 519.687 589.335 ↓ 7.6 143,529 1

Sort (cost=72,099.09..72,146.13 rows=18,816 width=54) (actual time=519.540..589.335 rows=143,529 loops=1)

  • Sort Key: own_fund_detail_3.factset_fund_id, own_fund_detail_3.adj_holding, own_fund_detail_3.report_date, own_fund_detail_3.reported_holding, own_fund_detail_3.adj_mv, own_fund_detail_3.reported_mv
  • Sort Method: quicksort Memory: 26321kB
54. 53.058 69.648 ↓ 7.6 143,529 1

Bitmap Heap Scan on own_fund_detail own_fund_detail_3 (cost=442.39..70,763.18 rows=18,816 width=54) (actual time=18.755..69.648 rows=143,529 loops=1)

  • Recheck Cond: (fsym_id = 'BHM9TN-S'::bpchar)
  • Heap Blocks: exact=13494
55. 16.590 16.590 ↓ 7.7 144,981 1

Bitmap Index Scan on own_fund_detail_fsym_id_report_date_idx (cost=0.00..437.69 rows=18,816 width=0) (actual time=16.589..16.590 rows=144,981 loops=1)

  • Index Cond: (fsym_id = 'BHM9TN-S'::bpchar)
56. 13.619 2,424.666 ↓ 8.6 6,617 1

Merge Left Join (cost=6,994.18..7,005.87 rows=769 width=112) (actual time=2,406.139..2,424.666 rows=6,617 loops=1)

  • Merge Cond: ((current_factset_fund_holdings.fsym_id = previous_factset_fund_holdings.fsym_id) AND (current_factset_fund_holdings.factset_fund_id = previous_factset_fund_holdings.factset_fund_id))
57. 9.955 2,378.070 ↓ 8.6 6,617 1

Sort (cost=3,497.09..3,499.01 rows=769 width=92) (actual time=2,375.568..2,378.070 rows=6,617 loops=1)

  • Sort Key: current_factset_fund_holdings.fsym_id, current_factset_fund_holdings.factset_fund_id
  • Sort Method: quicksort Memory: 709kB
58. 2,368.115 2,368.115 ↓ 8.6 6,617 1

CTE Scan on factset_fund_holdings current_factset_fund_holdings (cost=0.00..3,460.23 rows=769 width=92) (actual time=2,002.834..2,368.115 rows=6,617 loops=1)

  • Filter: (pos = 1)
  • Rows Removed by Filter: 71008
59. 10.784 32.977 ↓ 8.2 6,338 1

Sort (cost=3,497.09..3,499.01 rows=769 width=92) (actual time=30.565..32.977 rows=6,338 loops=1)

  • Sort Key: previous_factset_fund_holdings.fsym_id, previous_factset_fund_holdings.factset_fund_id
  • Sort Method: quicksort Memory: 688kB
60. 22.193 22.193 ↓ 8.2 6,338 1

CTE Scan on factset_fund_holdings previous_factset_fund_holdings (cost=0.00..3,460.23 rows=769 width=92) (actual time=0.006..22.193 rows=6,338 loops=1)

  • Filter: (pos = 2)
  • Rows Removed by Filter: 71287
61. 7.963 2,249.861 ↓ 9.6 6,524 1

Sort (cost=3,090.03..3,091.73 rows=680 width=88) (actual time=2,246.912..2,249.861 rows=6,524 loops=1)

  • Sort Key: factset_prev_fund_holdings.fsym_id, factset_prev_fund_holdings.factset_fund_id
  • Sort Method: quicksort Memory: 702kB
62. 2,241.898 2,241.898 ↓ 9.6 6,524 1

CTE Scan on factset_prev_fund_holdings (cost=0.00..3,058.04 rows=680 width=88) (actual time=1,956.649..2,241.898 rows=6,524 loops=1)

  • Filter: (pos = 1)
  • Rows Removed by Filter: 57911
63. 59.553 59.553 ↑ 1.0 1 6,617

Index Scan using own_ent_funds_pkey on own_ent_funds (cost=0.42..6.66 rows=1 width=31) (actual time=0.008..0.009 rows=1 loops=6,617)

  • Index Cond: (factset_fund_id = current_factset_fund_holdings.factset_fund_id)
64. 28.816 57.246 ↑ 1.0 65,078 1

Hash (cost=1,542.78..1,542.78 rows=65,078 width=26) (actual time=57.246..57.246 rows=65,078 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 3926kB
65. 28.430 28.430 ↑ 1.0 65,078 1

Seq Scan on q4_fund_values (cost=0.00..1,542.78 rows=65,078 width=26) (actual time=0.007..28.430 rows=65,078 loops=1)

66. 66.170 66.170 ↑ 1.0 1 6,617

Index Scan using sym_entity_pkey on sym_entity inst_entity (cost=0.43..4.19 rows=1 width=37) (actual time=0.009..0.010 rows=1 loops=6,617)

  • Index Cond: (factset_entity_id = own_ent_funds.factset_inst_entity_id)
67. 59.553 59.553 ↑ 1.0 1 6,617

Index Scan using sym_entity_pkey on sym_entity fund_entity (cost=0.43..4.19 rows=1 width=40) (actual time=0.009..0.009 rows=1 loops=6,617)

  • Index Cond: (factset_entity_id = own_ent_funds.factset_fund_id)
68. 59.553 59.553 ↑ 1.0 1 6,617

Index Scan using h_entity_pkey on h_entity (cost=0.43..2.16 rows=1 width=37) (actual time=0.009..0.009 rows=1 loops=6,617)

  • Index Cond: (factset_entity_id = own_ent_funds.factset_fund_id)
69. 59.553 59.553 ↑ 1.0 1 6,617

Index Scan using cyclops_fund_overwrites_pkey on cyclops_fund_overwrites cyclops (cost=0.42..6.86 rows=1 width=51) (actual time=0.008..0.009 rows=1 loops=6,617)

  • Index Cond: (factset_fund_id = current_factset_fund_holdings.factset_fund_id)
70. 0.184 0.329 ↑ 1.0 270 1

Hash (cost=4.70..4.70 rows=270 width=15) (actual time=0.329..0.329 rows=270 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
71. 0.145 0.145 ↑ 1.0 270 1

Seq Scan on country_map (cost=0.00..4.70 rows=270 width=15) (actual time=0.008..0.145 rows=270 loops=1)

72. 0.006 0.016 ↑ 1.0 8 1

Hash (cost=1.08..1.08 rows=8 width=76) (actual time=0.016..0.016 rows=8 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
73. 0.010 0.010 ↑ 1.0 8 1

Seq Scan on region_map (cost=0.00..1.08 rows=8 width=76) (actual time=0.005..0.010 rows=8 loops=1)

74. 59.553 59.553 ↑ 1.0 1 6,617

Index Scan using ent_entity_metro_areas_pkey on ent_entity_metro_areas (cost=0.43..0.46 rows=1 width=13) (actual time=0.009..0.009 rows=1 loops=6,617)

  • Index Cond: (factset_entity_id = inst_entity.factset_entity_id)
75. 0.105 0.208 ↑ 1.0 185 1

Hash (cost=3.85..3.85 rows=185 width=24) (actual time=0.208..0.208 rows=185 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
76. 0.103 0.103 ↑ 1.0 185 1

Seq Scan on metro_map (cost=0.00..3.85 rows=185 width=24) (actual time=0.007..0.103 rows=185 loops=1)

77. 0.013 0.029 ↑ 1.0 19 1

Hash (cost=1.19..1.19 rows=19 width=84) (actual time=0.029..0.029 rows=19 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
78. 0.016 0.016 ↑ 1.0 19 1

Seq Scan on fund_type_map (cost=0.00..1.19 rows=19 width=84) (actual time=0.005..0.016 rows=19 loops=1)

79. 52.936 52.936 ↑ 2.0 1 6,617

Index Scan using own_sec_prices_pkey on own_sec_prices prices (cost=0.57..11.33 rows=2 width=45) (actual time=0.008..0.008 rows=1 loops=6,617)

  • Index Cond: ((fsym_id = current_factset_fund_holdings.fsym_id) AND (price_date = (date_trunc('month'::text, (current_factset_fund_holdings.report_date)::timestamp with time zone) - '1 day'::interval)))
80.          

SubPlan (forNested Loop Left Join)

81. 185.276 251.446 ↑ 1.0 1 6,617

Aggregate (cost=8.46..8.46 rows=1 width=32) (actual time=0.038..0.038 rows=1 loops=6,617)

82. 66.170 66.170 ↓ 2.0 2 6,617

Index Scan using ent_entity_address_factset_entity_id_idx on ent_entity_address (cost=0.43..8.45 rows=1 width=60) (actual time=0.009..0.010 rows=2 loops=6,617)

  • Index Cond: (factset_entity_id = own_ent_funds.factset_inst_entity_id)
Planning time : 7.534 ms
Execution time : 5,547.969 ms