explain.depesz.com

PostgreSQL's explain analyze made readable

Result: jckl

Settings
# exclusive inclusive rows x rows loops node
1. 6.002 11,169.359 ↓ 379.0 758 1

Nested Loop Left Join (cost=147,443.67..147,517.30 rows=2 width=640) (actual time=1,886.280..11,169.359 rows=758 loops=1)

2. 1.004 11,004.935 ↓ 758.0 758 1

Nested Loop Left Join (cost=147,443.11..147,477.04 rows=1 width=495) (actual time=1,885.962..11,004.935 rows=758 loops=1)

3. 0.892 11,001.657 ↓ 758.0 758 1

Nested Loop Left Join (cost=147,442.97..147,476.87 rows=1 width=431) (actual time=1,885.954..11,001.657 rows=758 loops=1)

4. 1.163 10,998.491 ↓ 758.0 758 1

Nested Loop Left Join (cost=147,442.82..147,476.70 rows=1 width=415) (actual time=1,885.948..10,998.491 rows=758 loops=1)

5. 1.478 10,988.990 ↓ 758.0 758 1

Nested Loop Left Join (cost=147,442.39..147,476.23 rows=1 width=420) (actual time=1,885.931..10,988.990 rows=758 loops=1)

6. 1.667 10,985.996 ↓ 758.0 758 1

Nested Loop Left Join (cost=147,442.26..147,476.02 rows=1 width=354) (actual time=1,885.924..10,985.996 rows=758 loops=1)

7. 1.472 10,982.055 ↓ 758.0 758 1

Nested Loop Left Join (cost=147,442.11..147,475.85 rows=1 width=342) (actual time=1,885.916..10,982.055 rows=758 loops=1)

8. 1.609 10,973.003 ↓ 758.0 758 1

Nested Loop Left Join (cost=147,441.70..147,467.40 rows=1 width=326) (actual time=1,885.899..10,973.003 rows=758 loops=1)

9. 1.648 10,963.814 ↓ 758.0 758 1

Nested Loop Left Join (cost=147,441.27..147,465.23 rows=1 width=307) (actual time=1,885.884..10,963.814 rows=758 loops=1)

10. 1.035 10,954.586 ↓ 758.0 758 1

Nested Loop Left Join (cost=147,440.83..147,461.03 rows=1 width=276) (actual time=1,885.868..10,954.586 rows=758 loops=1)

11. 1.093 10,944.455 ↓ 758.0 758 1

Nested Loop Left Join (cost=147,440.40..147,456.83 rows=1 width=239) (actual time=1,885.851..10,944.455 rows=758 loops=1)

12. 1.740 10,935.782 ↓ 758.0 758 1

Nested Loop Left Join (cost=147,439.99..147,448.39 rows=1 width=223) (actual time=1,885.835..10,935.782 rows=758 loops=1)

13. 616.669 10,924.188 ↓ 758.0 758 1

Nested Loop Left Join (cost=147,439.57..147,439.94 rows=1 width=192) (actual time=1,885.810..10,924.188 rows=758 loops=1)

  • Join Filter: ((current_factset_fund_holdings.factset_fund_id = factset_prev_fund_holdings.factset_fund_id) AND (factset_prev_fund_holdings.fsym_id = current_factset_fund_holdings.fsym_id))
  • Rows Removed by Join Filter: 2257324
14.          

CTE quarter_query

15. 96.568 1,775.959 ↓ 98.7 96,978 1

WindowAgg (cost=147,223.99..147,390.42 rows=983 width=73) (actual time=1,506.980..1,775.959 rows=96,978 loops=1)

16.          

CTE distinct_funds

17. 36.669 364.006 ↑ 2.4 7,978 1

Unique (cost=71,911.06..72,004.89 rows=18,760 width=54) (actual time=288.327..364.006 rows=7,978 loops=1)

18. 253.951 327.337 ↓ 7.6 143,507 1

Sort (cost=71,911.06..71,957.98 rows=18,767 width=54) (actual time=288.326..327.337 rows=143,507 loops=1)

  • Sort Key: own_fund_detail.factset_fund_id
  • Sort Method: quicksort Memory: 26319kB
19. 56.117 73.386 ↓ 7.6 143,507 1

Bitmap Heap Scan on own_fund_detail (cost=442.01..70,578.98 rows=18,767 width=54) (actual time=19.427..73.386 rows=143,507 loops=1)

  • Recheck Cond: (fsym_id = 'BHM9TN-S'::bpchar)
  • Heap Blocks: exact=13533
20. 17.269 17.269 ↓ 7.7 145,011 1

Bitmap Index Scan on own_fund_detail_fsym_id_report_date_idx (cost=0.00..437.32 rows=18,767 width=0) (actual time=17.269..17.269 rows=145,011 loops=1)

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

CTE distinct_holdings

22. 76.500 487.615 ↓ 7.6 143,507 1

Unique (cost=71,911.06..72,239.48 rows=18,760 width=54) (actual time=372.907..487.615 rows=143,507 loops=1)

23. 339.267 411.115 ↓ 7.6 143,507 1

Sort (cost=71,911.06..71,957.98 rows=18,767 width=54) (actual time=372.904..411.115 rows=143,507 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: 26319kB
24. 54.688 71.848 ↓ 7.6 143,507 1

Bitmap Heap Scan on own_fund_detail own_fund_detail_1 (cost=442.01..70,578.98 rows=18,767 width=54) (actual time=19.274..71.848 rows=143,507 loops=1)

  • Recheck Cond: (fsym_id = 'BHM9TN-S'::bpchar)
  • Heap Blocks: exact=13533
25. 17.160 17.160 ↓ 7.7 145,011 1

Bitmap Index Scan on own_fund_detail_fsym_id_report_date_idx (cost=0.00..437.32 rows=18,767 width=0) (actual time=17.160..17.160 rows=145,011 loops=1)

  • Index Cond: (fsym_id = 'BHM9TN-S'::bpchar)
26. 104.126 1,679.391 ↓ 98.7 96,978 1

Merge Left Join (cost=2,979.62..3,128.84 rows=983 width=81) (actual time=1,506.973..1,679.391 rows=96,978 loops=1)

  • Merge Cond: ((s.factset_fund_id = adjh.factset_fund_id) AND (q4_fund_dates.report_date = adjh.report_date))
27. 185.456 773.155 ↓ 98.7 96,978 1

Sort (cost=1,272.90..1,275.35 rows=983 width=73) (actual time=743.590..773.155 rows=96,978 loops=1)

  • Sort Key: s.factset_fund_id, q4_fund_dates.report_date DESC
  • Sort Method: quicksort Memory: 16703kB
28. 53.983 587.699 ↓ 98.7 96,978 1

Nested Loop (cost=1.26..1,224.04 rows=983 width=73) (actual time=288.413..587.699 rows=96,978 loops=1)

  • Join Filter: (s.factset_fund_id = q4_fund_dates.factset_fund_id)
29. 3.043 439.468 ↓ 124.7 6,732 1

Nested Loop (cost=0.84..1,097.14 rows=54 width=78) (actual time=288.391..439.468 rows=6,732 loops=1)

30. 0.017 0.017 ↑ 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.016..0.017 rows=1 loops=1)

  • Index Cond: (fsym_id = 'BHM9TN-S'::bpchar)
  • Heap Fetches: 1
31. 11.330 436.408 ↓ 124.7 6,732 1

Nested Loop (cost=0.42..1,088.16 rows=54 width=105) (actual time=288.373..436.408 rows=6,732 loops=1)

32. 369.232 369.232 ↓ 84.9 7,978 1

CTE Scan on distinct_funds s (cost=0.00..422.10 rows=94 width=96) (actual time=288.340..369.232 rows=7,978 loops=1)

  • Filter: (fsym_id = 'BHM9TN-S'::bpchar)
33. 55.846 55.846 ↑ 1.0 1 7,978

Index Only Scan using own_ent_funds_factset_fund_id_current_report_date_active_flag_i on own_ent_funds ent (cost=0.42..7.08 rows=1 width=9) (actual time=0.007..0.007 rows=1 loops=7,978)

  • Index Cond: ((factset_fund_id = s.factset_fund_id) AND (active_flag = 1))
  • Heap Fetches: 5463
34. 94.248 94.248 ↑ 1.3 14 6,732

Index Only Scan using q4_fund_dates_pkey on q4_fund_dates (cost=0.43..2.12 rows=18 width=13) (actual time=0.009..0.014 rows=14 loops=6,732)

  • Index Cond: ((factset_fund_id = ent.factset_fund_id) AND (report_date >= '2016-12-31'::date) AND (report_date <= '2019-06-07'::date))
  • Heap Fetches: 96978
35. 233.093 802.110 ↓ 7.6 143,507 1

Sort (cost=1,706.73..1,753.63 rows=18,760 width=48) (actual time=763.376..802.110 rows=143,507 loops=1)

  • Sort Key: adjh.factset_fund_id, adjh.report_date DESC
  • Sort Method: quicksort Memory: 17353kB
36. 569.017 569.017 ↓ 7.6 143,507 1

CTE Scan on distinct_holdings adjh (cost=0.00..375.20 rows=18,760 width=48) (actual time=372.910..569.017 rows=143,507 loops=1)

37.          

CTE factset_fund_holdings

38. 1,824.394 1,824.394 ↓ 172.6 863 1

CTE Scan on quarter_query curr (cost=0.00..24.58 rows=5 width=100) (actual time=1,507.243..1,824.394 rows=863 loops=1)

  • Filter: ((report_date >= '2019-05-31'::date) AND (report_date <= '2019-06-07'::date))
  • Rows Removed by Filter: 96115
39.          

CTE factset_prev_fund_holdings

40. 31.593 31.593 ↓ 16,786.4 83,932 1

CTE Scan on quarter_query prev (cost=0.00..24.58 rows=5 width=100) (actual time=0.006..31.593 rows=83,932 loops=1)

  • Filter: ((report_date >= '2016-12-31'::date) AND (report_date <= '2018-12-31'::date))
  • Rows Removed by Filter: 13046
41. 9.761 1,936.167 ↓ 758.0 758 1

Nested Loop Left Join (cost=0.00..0.24 rows=1 width=112) (actual time=1,824.825..1,936.167 rows=758 loops=1)

  • Join Filter: ((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))
  • Rows Removed by Join Filter: 25738
42. 1,507.990 1,507.990 ↓ 758.0 758 1

CTE Scan on factset_fund_holdings current_factset_fund_holdings (cost=0.00..0.11 rows=1 width=92) (actual time=1,507.246..1,507.990 rows=758 loops=1)

  • Filter: (pos = 1)
  • Rows Removed by Filter: 105
43. 418.416 418.416 ↓ 34.0 34 758

CTE Scan on factset_fund_holdings previous_factset_fund_holdings (cost=0.00..0.11 rows=1 width=92) (actual time=0.016..0.552 rows=34 loops=758)

  • Filter: (pos = 2)
  • Rows Removed by Filter: 829
44. 8,371.352 8,371.352 ↓ 2,978.0 2,978 758

CTE Scan on factset_prev_fund_holdings (cost=0.00..0.11 rows=1 width=88) (actual time=0.012..11.044 rows=2,978 loops=758)

  • Filter: (pos = 1)
  • Rows Removed by Filter: 80954
45. 9.854 9.854 ↑ 1.0 1 758

Index Scan using own_ent_funds_factset_fund_id_current_report_date_active_flag_i on own_ent_funds (cost=0.42..8.44 rows=1 width=31) (actual time=0.012..0.013 rows=1 loops=758)

  • Index Cond: (current_factset_fund_holdings.factset_fund_id = factset_fund_id)
46. 7.580 7.580 ↑ 1.0 1 758

Index Scan using q4_fund_values_pkey on q4_fund_values (cost=0.41..8.43 rows=1 width=26) (actual time=0.009..0.010 rows=1 loops=758)

  • Index Cond: (factset_fund_id = current_factset_fund_holdings.factset_fund_id)
47. 9.096 9.096 ↑ 1.0 1 758

Index Scan using sym_entity_pkey on sym_entity inst_entity (cost=0.43..4.19 rows=1 width=37) (actual time=0.011..0.012 rows=1 loops=758)

  • Index Cond: (factset_entity_id = own_ent_funds.factset_inst_entity_id)
48. 7.580 7.580 ↑ 1.0 1 758

Index Scan using sym_entity_pkey on sym_entity fund_entity (cost=0.43..4.19 rows=1 width=40) (actual time=0.010..0.010 rows=1 loops=758)

  • Index Cond: (factset_entity_id = own_ent_funds.factset_fund_id)
49. 7.580 7.580 ↑ 1.0 1 758

Index Scan using h_entity_pkey on h_entity (cost=0.43..2.16 rows=1 width=37) (actual time=0.010..0.010 rows=1 loops=758)

  • Index Cond: (factset_entity_id = own_ent_funds.factset_fund_id)
50. 7.580 7.580 ↑ 1.0 1 758

Index Scan using cyclops_fund_overwrites_pkey on cyclops_fund_overwrites cyclops (cost=0.42..8.44 rows=1 width=26) (actual time=0.010..0.010 rows=1 loops=758)

  • Index Cond: (factset_fund_id = current_factset_fund_holdings.factset_fund_id)
51. 2.274 2.274 ↑ 1.0 1 758

Index Scan using country_map_pkey on country_map (cost=0.15..0.17 rows=1 width=15) (actual time=0.003..0.003 rows=1 loops=758)

  • Index Cond: (iso_country = fund_entity.iso_country)
52. 1.516 1.516 ↑ 1.0 1 758

Index Scan using region_map_pkey on region_map (cost=0.13..0.19 rows=1 width=76) (actual time=0.002..0.002 rows=1 loops=758)

  • Index Cond: (region_code = country_map.region_code)
53. 8.338 8.338 ↑ 1.0 1 758

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.010..0.011 rows=1 loops=758)

  • Index Cond: (factset_entity_id = inst_entity.factset_entity_id)
54. 2.274 2.274 ↑ 1.0 1 758

Index Scan using metro_map_pkey on metro_map (cost=0.14..0.16 rows=1 width=24) (actual time=0.002..0.003 rows=1 loops=758)

  • Index Cond: (metro_code = ent_entity_metro_areas.metro_id)
55. 2.274 2.274 ↑ 1.0 1 758

Index Scan using fund_type_map_pkey on fund_type_map (cost=0.14..0.16 rows=1 width=84) (actual time=0.002..0.003 rows=1 loops=758)

  • Index Cond: (fund_type_code = own_ent_funds.fund_type)
56. 8.338 8.338 ↑ 2.0 1 758

Index Scan using own_sec_prices_pkey on own_sec_prices prices (cost=0.57..11.38 rows=2 width=45) (actual time=0.010..0.011 rows=1 loops=758)

  • 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)))
57.          

SubPlan (forNested Loop Left Join)

58. 21.982 150.084 ↑ 1.0 1 758

Aggregate (cost=14.39..14.40 rows=1 width=32) (actual time=0.198..0.198 rows=1 loops=758)

59. 3.908 128.102 ↓ 2.0 2 758

Nested Loop Left Join (cost=8.59..14.39 rows=1 width=138) (actual time=0.108..0.169 rows=2 loops=758)

60. 59.254 121.280 ↓ 2.0 2 758

Hash Right Join (cost=8.46..14.18 rows=1 width=72) (actual time=0.103..0.160 rows=2 loops=758)

  • Hash Cond: (country_map_1.iso_country = ent_entity_address.iso_country)
61. 49.140 49.140 ↑ 1.0 270 756

Seq Scan on country_map country_map_1 (cost=0.00..4.70 rows=270 width=15) (actual time=0.002..0.065 rows=270 loops=756)

62. 2.274 12.886 ↓ 2.0 2 758

Hash (cost=8.45..8.45 rows=1 width=60) (actual time=0.017..0.017 rows=2 loops=758)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
63. 10.612 10.612 ↓ 2.0 2 758

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.012..0.014 rows=2 loops=758)

  • Index Cond: (factset_entity_id = own_ent_funds.factset_inst_entity_id)
64. 2.914 2.914 ↑ 1.0 1 1,457

Index Scan using region_map_pkey on region_map region_map_1 (cost=0.13..0.19 rows=1 width=76) (actual time=0.002..0.002 rows=1 loops=1,457)

  • Index Cond: (region_code = country_map_1.region_code)
Planning time : 3.867 ms
Execution time : 11,179.990 ms