explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JmE

Settings
# exclusive inclusive rows x rows loops node
1. 0.024 2,998.145 ↑ 1,850.7 47 1

Limit (cost=1,652,884.73..275,592,701.14 rows=86,982 width=670) (actual time=2,978.672..2,998.145 rows=47 loops=1)

2. 1.680 2,998.121 ↑ 1,850.7 47 1

Result (cost=1,652,884.73..275,592,701.14 rows=86,982 width=670) (actual time=2,978.671..2,998.121 rows=47 loops=1)

3. 0.147 2,977.962 ↑ 1,850.7 47 1

Sort (cost=1,652,858.58..1,653,076.03 rows=86,982 width=357) (actual time=2,977.945..2,977.962 rows=47 loops=1)

  • Sort Key: (((a3.t6 / NULLIF((SubPlan 30), '0'::numeric)) - '1'::numeric)) NULLS FIRST, a1.id
  • Sort Method: quicksort Memory: 36kB
4. 10.318 2,977.815 ↑ 1,850.7 47 1

Hash Left Join (cost=83,853.73..1,631,449.39 rows=86,982 width=357) (actual time=651.358..2,977.815 rows=47 loops=1)

  • Hash Cond: ((SubPlan 50) = a8.id)
5. 3.546 2,863.887 ↑ 1,850.7 47 1

Hash Left Join (cost=77,132.20..1,271,343.27 rows=86,982 width=162) (actual time=548.164..2,863.887 rows=47 loops=1)

  • Hash Cond: (a1.id = a9.stock_id)
6. 324.898 2,709.376 ↑ 1,850.7 47 1

Hash Left Join (cost=69,907.13..1,259,583.86 rows=86,982 width=154) (actual time=397.043..2,709.376 rows=47 loops=1)

  • Hash Cond: ((SubPlan 49) = a7.id)
  • Filter: (((a5.equity_pct__apc > '0'::numeric) AND (a5.equity_pct__apc IS NOT NULL)) OR ((COALESCE((SubPlan 55), CASE WHEN ((SubPlan 56) = ANY ('{Hold,""No Trade"",Cancelled,Completed}'::text[])) THEN (SubPlan 57) ELSE COALESCE(CASE WHEN ((SubPlan 58) <> ALL ('{Hold,""No Trade""}'::text[])) THEN a7.target_size ELSE NULL::numeric END, (SubPlan 59)) END, '0'::numeric) >= 0.0002) AND (COALESCE((SubPlan 64), CASE WHEN ((SubPlan 65) = ANY ('{Hold,""No Trade"",Cancelled,Completed}'::text[])) THEN (SubPlan 66) ELSE COALESCE(CASE WHEN ((SubPlan 67) <> ALL ('{Hold,""No Trade""}'::text[])) THEN a7.target_size ELSE NULL::numeric END, (SubPlan 68)) END, '0'::numeric) IS NOT NULL)) OR ((CASE WHEN a5.idealperfectlysized__srf THEN a5.equity_pct__apc ELSE a5.idealsize__srf END > '0'::numeric) AND (CASE WHEN a5.idealperfectlysized__srf THEN a5.equity_pct__apc ELSE a5.idealsize__srf END IS NOT NULL)))
  • Rows Removed by Filter: 57,631
7. 96.358 1,650.856 ↑ 2.7 57,678 1

Nested Loop Left Join (cost=63,328.60..1,177,887.66 rows=157,197 width=146) (actual time=263.241..1,650.856 rows=57,678 loops=1)

8. 83.327 1,323.786 ↓ 1.2 57,678 1

Nested Loop Left Join (cost=63,327.01..899,304.65 rows=49,721 width=99) (actual time=263.228..1,323.786 rows=57,678 loops=1)

9. 53.595 1,240.459 ↓ 1.2 57,678 1

Hash Left Join (cost=63,326.58..625,366.27 rows=49,721 width=95) (actual time=263.220..1,240.459 rows=57,678 loops=1)

  • Hash Cond: (a1.id = a10.stock_id)
10. 69.946 1,150.442 ↓ 1.2 57,678 1

Hash Left Join (cost=61,456.29..623,365.45 rows=49,721 width=86) (actual time=226.729..1,150.442 rows=57,678 loops=1)

  • Hash Cond: (a1.id = a6.stock_id)
11. 61.687 983.944 ↓ 1.2 57,678 1

Hash Left Join (cost=32,256.12..592,384.75 rows=49,721 width=75) (actual time=129.980..983.944 rows=57,678 loops=1)

  • Hash Cond: (a1.id = a5.stock_id)
12. 73.852 845.688 ↓ 1.2 57,678 1

Nested Loop Left Join (cost=2,979.38..561,513.49 rows=49,721 width=64) (actual time=52.933..845.688 rows=57,678 loops=1)

  • Filter: (a11.archive_on IS NULL)
  • Rows Removed by Filter: 7,537
13. 82.157 576.191 ↓ 1.0 65,215 1

Hash Join (cost=2,978.81..37,378.35 rows=63,942 width=68) (actual time=52.913..576.191 rows=65,215 loops=1)

  • Hash Cond: (a2.stock_id = a1.id)
14. 441.278 441.278 ↓ 1.0 65,216 1

Seq Scan on stock_fields a2 (cost=0.00..32,524.67 rows=63,943 width=64) (actual time=0.021..441.278 rows=65,216 loops=1)

  • Filter: ((parent_stock_id IS NULL) AND ct_inmaster_last AND (ct_inmaster_last IS NOT NULL) AND ((bb_stock_ticker_last !~* '^(betb\\ av)$'::text) OR (bb_stock_ticker_last IS NULL)) AND ((tag__2050 <> 22433) OR (tag__2050 IS NULL)))
  • Rows Removed by Filter: 20,029
15. 27.424 52.756 ↓ 1.0 85,246 1

Hash (cost=1,580.41..1,580.41 rows=85,232 width=8) (actual time=52.756..52.756 rows=85,246 loops=1)

  • Buckets: 131,072 Batches: 2 Memory Usage: 2,689kB
16. 25.332 25.332 ↓ 1.0 85,246 1

Seq Scan on stocks a1 (cost=0.00..1,580.41 rows=85,232 width=8) (actual time=0.007..25.332 rows=85,246 loops=1)

  • Filter: ((id IS NOT NULL) AND (id <> 87532))
  • Rows Removed by Filter: 1
17. 195.645 195.645 ↑ 1.0 1 65,215

Index Scan using entities_pkey on entities a11 (cost=0.57..8.19 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=65,215)

  • Index Cond: (id = a1.entity_id)
18. 24.768 76.569 ↑ 1.0 79,652 1

Hash (cost=27,875.75..27,875.75 rows=80,559 width=15) (actual time=76.569..76.569 rows=79,652 loops=1)

  • Buckets: 131,072 Batches: 2 Memory Usage: 2,429kB
19. 47.176 51.801 ↑ 1.0 79,652 1

Bitmap Heap Scan on stock_fields_fund_specific a5 (cost=1,508.76..27,875.75 rows=80,559 width=15) (actual time=4.856..51.801 rows=79,652 loops=1)

  • Recheck Cond: (fund_id = 3)
  • Heap Blocks: exact=1,983
20. 4.625 4.625 ↑ 1.0 79,654 1

Bitmap Index Scan on stock_fields_fund_specific_fund_stock_idx (cost=0.00..1,488.62 rows=80,559 width=0) (actual time=4.624..4.625 rows=79,654 loops=1)

  • Index Cond: (fund_id = 3)
21. 26.811 96.552 ↓ 1.0 79,638 1

Hash (cost=27,827.25..27,827.25 rows=78,954 width=15) (actual time=96.552..96.552 rows=79,638 loops=1)

  • Buckets: 131,072 Batches: 2 Memory Usage: 2,427kB
22. 64.835 69.741 ↓ 1.0 79,638 1

Bitmap Heap Scan on stock_fields_fund_specific a6 (cost=1,480.32..27,827.25 rows=78,954 width=15) (actual time=6.710..69.741 rows=79,638 loops=1)

  • Recheck Cond: (fund_id = 4)
  • Heap Blocks: exact=13,262
23. 4.906 4.906 ↓ 1.0 79,668 1

Bitmap Index Scan on stock_fields_fund_specific_fund_stock_idx (cost=0.00..1,460.59 rows=78,954 width=0) (actual time=4.906..4.906 rows=79,668 loops=1)

  • Index Cond: (fund_id = 4)
24. 19.210 36.422 ↓ 1.0 62,729 1

Hash (cost=1,086.24..1,086.24 rows=62,724 width=13) (actual time=36.422..36.422 rows=62,729 loops=1)

  • Buckets: 65,536 Batches: 1 Memory Usage: 3,453kB
25. 17.212 17.212 ↓ 1.0 62,729 1

Seq Scan on factset_mappings a10 (cost=0.00..1,086.24 rows=62,724 width=13) (actual time=0.007..17.212 rows=62,729 loops=1)

26. 0.000 0.000 ↓ 0.0 0 57,678

Index Scan using private_company_fields_pkey on private_company_fields a4 (cost=0.43..5.51 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=57,678)

  • Index Cond: (id = a2.private_company_id)
27. 115.356 230.712 ↑ 1.0 1 57,678

Bitmap Heap Scan on price_history_cache a3 (cost=1.59..5.60 rows=1 width=51) (actual time=0.004..0.004 rows=1 loops=57,678)

  • Recheck Cond: (stock_id = a1.id)
  • Heap Blocks: exact=46,552
28. 115.356 115.356 ↑ 1.0 1 57,678

Bitmap Index Scan on price_history_cache_pkey (cost=0.00..1.59 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=57,678)

  • Index Cond: (stock_id = a1.id)
29. 49.569 99.648 ↑ 1.0 145,533 1

Hash (cost=4,047.79..4,047.79 rows=145,579 width=12) (actual time=99.647..99.648 rows=145,533 loops=1)

  • Buckets: 131,072 Batches: 4 Memory Usage: 2,514kB
30. 50.079 50.079 ↑ 1.0 145,533 1

Seq Scan on trade_requests a7 (cost=0.00..4,047.79 rows=145,579 width=12) (actual time=0.006..50.079 rows=145,533 loops=1)

31.          

SubPlan (for Hash Left Join)

32. 57.561 230.524 ↑ 1.0 1 57,631

Aggregate (cost=1,508.94..1,508.95 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=57,631)

33. 0.000 172.893 ↓ 0.0 0 57,631

Nested Loop Left Join (cost=9.72..471.62 rows=21 width=27) (actual time=0.003..0.003 rows=0 loops=57,631)

34. 57.631 172.893 ↓ 0.0 0 57,631

Nested Loop Left Join (cost=9.29..430.67 rows=21 width=20) (actual time=0.003..0.003 rows=0 loops=57,631)

35. 57.561 115.262 ↓ 0.0 0 57,631

Nested Loop (cost=0.71..247.23 rows=21 width=4) (actual time=0.002..0.002 rows=0 loops=57,631)

36. 57.631 57.631 ↓ 0.0 0 57,631

Index Scan using stock_fields_parent_stock_id_idx on stock_fields x4_1 (cost=0.42..72.71 rows=21 width=4) (actual time=0.001..0.001 rows=0 loops=57,631)

  • Index Cond: (parent_stock_id = a1.id)
37. 0.070 0.070 ↑ 1.0 1 35

Index Scan using stocks_pkey on stocks x1_1 (cost=0.29..8.31 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=35)

  • Index Cond: (id = x4_1.stock_id)
38. 0.000 0.000 ↓ 0.0 0 35

Index Scan using trade_requests_pkey on trade_requests x2_1 (cost=8.58..8.74 rows=1 width=20) (actual time=0.000..0.000 rows=0 loops=35)

  • Index Cond: (id = (SubPlan 54))
39.          

SubPlan (for Index Scan)

40. 0.035 0.035 ↓ 0.0 0 35

Index Scan using active_trades_status_idx on trade_requests trade_requests_13 (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=35)

  • Index Cond: ((stock_id = x1_1.id) AND (fund_id = 3))
41. 0.105 0.105 ↑ 1.0 1 35

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific x3_1 (cost=0.43..1.95 rows=1 width=11) (actual time=0.003..0.003 rows=1 loops=35)

  • Index Cond: ((fund_id = 3) AND (stock_id = x1_1.id))
42.          

SubPlan (for Aggregate)

43. 0.000 0.035 ↓ 0.0 0 35

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual time=0.001..0.001 rows=0 loops=35)

44. 0.035 0.035 ↓ 0.0 0 35

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_10 (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=35)

  • Index Cond: ((stock_id = x1_1.id) AND (fund_id = 3))
  • Heap Fetches: 0
45. 0.000 0.000 ↓ 0.0 0

Index Scan using tag_values_pkey on tag_values tag_values_7 (cost=0.29..8.30 rows=1 width=15) (never executed)

  • Index Cond: (id = trade_requests_10.status)
46. 0.000 0.035 ↓ 0.0 0 35

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual time=0.001..0.001 rows=0 loops=35)

47. 0.035 0.035 ↓ 0.0 0 35

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_11 (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=35)

  • Index Cond: ((stock_id = x1_1.id) AND (fund_id = 3))
  • Heap Fetches: 0
48. 0.000 0.000 ↓ 0.0 0

Index Scan using tag_values_pkey on tag_values tag_values_8 (cost=0.29..8.30 rows=1 width=15) (never executed)

  • Index Cond: (id = trade_requests_11.status)
49. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (never executed)

50. 0.000 0.000 ↓ 0.0 0

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_12 (cost=0.14..8.16 rows=1 width=4) (never executed)

  • Index Cond: ((stock_id = x1_1.id) AND (fund_id = 3))
  • Heap Fetches: 0
51. 0.000 0.000 ↓ 0.0 0

Index Scan using tag_values_pkey on tag_values tag_values_9 (cost=0.29..8.30 rows=1 width=15) (never executed)

  • Index Cond: (id = trade_requests_12.status)
52. 0.000 57.631 ↓ 0.0 0 57,631

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual time=0.001..0.001 rows=0 loops=57,631)

53. 57.631 57.631 ↓ 0.0 0 57,631

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_14 (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=57,631)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
  • Heap Fetches: 6
54. 0.030 0.030 ↑ 1.0 1 6

Index Scan using tag_values_pkey on tag_values tag_values_10 (cost=0.29..8.30 rows=1 width=15) (actual time=0.005..0.005 rows=1 loops=6)

  • Index Cond: (id = trade_requests_14.status)
55. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=8.45..8.46 rows=1 width=32) (never executed)

56. 0.000 0.000 ↓ 0.0 0

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific stock_fields_fund_specific_3 (cost=0.43..8.45 rows=1 width=7) (never executed)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id))
57. 0.000 57.631 ↓ 0.0 0 57,631

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual time=0.001..0.001 rows=0 loops=57,631)

58. 57.631 57.631 ↓ 0.0 0 57,631

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_15 (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=57,631)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
  • Heap Fetches: 6
59. 0.012 0.012 ↑ 1.0 1 6

Index Scan using tag_values_pkey on tag_values tag_values_11 (cost=0.29..8.30 rows=1 width=15) (actual time=0.002..0.002 rows=1 loops=6)

  • Index Cond: (id = trade_requests_15.status)
60. 57.625 230.500 ↑ 1.0 1 57,625

Aggregate (cost=8.45..8.46 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=57,625)

61. 172.875 172.875 ↑ 1.0 1 57,625

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific stock_fields_fund_specific_4 (cost=0.43..8.45 rows=1 width=7) (actual time=0.003..0.003 rows=1 loops=57,625)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id))
62. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=1,508.94..1,508.95 rows=1 width=32) (never executed)

63. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=9.72..471.62 rows=21 width=27) (never executed)

64. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=9.29..430.67 rows=21 width=20) (never executed)

65. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.71..247.23 rows=21 width=4) (never executed)

66. 0.000 0.000 ↓ 0.0 0

Index Scan using stock_fields_parent_stock_id_idx on stock_fields x4_2 (cost=0.42..72.71 rows=21 width=4) (never executed)

  • Index Cond: (parent_stock_id = a1.id)
67. 0.000 0.000 ↓ 0.0 0

Index Scan using stocks_pkey on stocks x1_2 (cost=0.29..8.31 rows=1 width=8) (never executed)

  • Index Cond: (id = x4_2.stock_id)
68. 0.000 0.000 ↓ 0.0 0

Index Scan using trade_requests_pkey on trade_requests x2_2 (cost=8.58..8.74 rows=1 width=20) (never executed)

  • Index Cond: (id = (SubPlan 63))
69.          

SubPlan (for Index Scan)

70. 0.000 0.000 ↓ 0.0 0

Index Scan using active_trades_status_idx on trade_requests trade_requests_19 (cost=0.14..8.16 rows=1 width=4) (never executed)

  • Index Cond: ((stock_id = x1_2.id) AND (fund_id = 3))
71. 0.000 0.000 ↓ 0.0 0

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific x3_2 (cost=0.43..1.95 rows=1 width=11) (never executed)

  • Index Cond: ((fund_id = 3) AND (stock_id = x1_2.id))
72.          

SubPlan (for Aggregate)

73. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (never executed)

74. 0.000 0.000 ↓ 0.0 0

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_16 (cost=0.14..8.16 rows=1 width=4) (never executed)

  • Index Cond: ((stock_id = x1_2.id) AND (fund_id = 3))
  • Heap Fetches: 0
75. 0.000 0.000 ↓ 0.0 0

Index Scan using tag_values_pkey on tag_values tag_values_12 (cost=0.29..8.30 rows=1 width=15) (never executed)

  • Index Cond: (id = trade_requests_16.status)
76. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (never executed)

77. 0.000 0.000 ↓ 0.0 0

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_17 (cost=0.14..8.16 rows=1 width=4) (never executed)

  • Index Cond: ((stock_id = x1_2.id) AND (fund_id = 3))
  • Heap Fetches: 0
78. 0.000 0.000 ↓ 0.0 0

Index Scan using tag_values_pkey on tag_values tag_values_13 (cost=0.29..8.30 rows=1 width=15) (never executed)

  • Index Cond: (id = trade_requests_17.status)
79. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (never executed)

80. 0.000 0.000 ↓ 0.0 0

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_18 (cost=0.14..8.16 rows=1 width=4) (never executed)

  • Index Cond: ((stock_id = x1_2.id) AND (fund_id = 3))
  • Heap Fetches: 0
81. 0.000 0.000 ↓ 0.0 0

Index Scan using tag_values_pkey on tag_values tag_values_14 (cost=0.29..8.30 rows=1 width=15) (never executed)

  • Index Cond: (id = trade_requests_18.status)
82. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (never executed)

83. 0.000 0.000 ↓ 0.0 0

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_20 (cost=0.14..8.16 rows=1 width=4) (never executed)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
  • Heap Fetches: 0
84. 0.000 0.000 ↓ 0.0 0

Index Scan using tag_values_pkey on tag_values tag_values_15 (cost=0.29..8.30 rows=1 width=15) (never executed)

  • Index Cond: (id = trade_requests_20.status)
85. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=8.45..8.46 rows=1 width=32) (never executed)

86. 0.000 0.000 ↓ 0.0 0

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific stock_fields_fund_specific_5 (cost=0.43..8.45 rows=1 width=7) (never executed)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id))
87. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (never executed)

88. 0.000 0.000 ↓ 0.0 0

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_21 (cost=0.14..8.16 rows=1 width=4) (never executed)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
  • Heap Fetches: 0
89. 0.000 0.000 ↓ 0.0 0

Index Scan using tag_values_pkey on tag_values tag_values_16 (cost=0.29..8.30 rows=1 width=15) (never executed)

  • Index Cond: (id = trade_requests_21.status)
90. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=8.45..8.46 rows=1 width=32) (never executed)

91. 0.000 0.000 ↓ 0.0 0

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific stock_fields_fund_specific_6 (cost=0.43..8.45 rows=1 width=7) (never executed)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id))
92. 0.000 57.688 ↓ 0.0 0 57,688

Limit (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=57,688)

93. 57.688 57.688 ↓ 0.0 0 57,688

Index Scan using active_trades_status_idx on trade_requests trade_requests_8 (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=57,688)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
94. 28.940 150.965 ↑ 1.0 81,381 1

Hash (cost=5,809.81..5,809.81 rows=81,381 width=12) (actual time=150.965..150.965 rows=81,381 loops=1)

  • Buckets: 131,072 Batches: 2 Memory Usage: 2,482kB
95. 122.025 122.025 ↑ 1.0 81,381 1

Seq Scan on stock_fields_extension a9 (cost=0.00..5,809.81 rows=81,381 width=12) (actual time=0.009..122.025 rows=81,381 loops=1)

96. 52.324 103.085 ↑ 1.0 145,533 1

Hash (cost=4,047.79..4,047.79 rows=145,579 width=20) (actual time=103.085..103.085 rows=145,533 loops=1)

  • Buckets: 65,536 Batches: 4 Memory Usage: 2,291kB
97. 50.761 50.761 ↑ 1.0 145,533 1

Seq Scan on trade_requests a8 (cost=0.00..4,047.79 rows=145,579 width=20) (actual time=0.007..50.761 rows=145,533 loops=1)

98.          

SubPlan (for Hash Left Join)

99. 0.094 0.423 ↑ 1.0 1 47

Limit (cost=0.56..3.58 rows=1 width=26) (actual time=0.008..0.009 rows=1 loops=47)

100. 0.329 0.329 ↑ 8.0 1 47

Index Scan Backward using price_history_new_stock_id_price_date_price_usd_split_adjusted_ on price_history_raw price_history_raw_3 (cost=0.56..24.71 rows=8 width=26) (actual time=0.007..0.007 rows=1 loops=47)

  • Index Cond: ((stock_id = a1.id) AND (price_date <= '2020-09-02'::date) AND (price_date > '2020-08-25'::date))
101. 0.102 0.102 ↓ 0.0 0 51

Index Scan using active_trades_status_idx on trade_requests trade_requests_9 (cost=0.14..8.16 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=51)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
102.          

SubPlan (for Result)

103. 0.047 0.423 ↑ 1.0 1 47

Aggregate (cost=250.25..250.26 rows=1 width=32) (actual time=0.009..0.009 rows=1 loops=47)

104. 0.199 0.376 ↓ 0.0 0 47

Index Scan using stock_fields_parent_stock_id_idx on stock_fields sf (cost=0.42..250.22 rows=11 width=8) (actual time=0.008..0.008 rows=0 loops=47)

  • Index Cond: (parent_stock_id = a1.id)
  • Filter: (SubPlan 1)
  • Rows Removed by Filter: 1
105.          

SubPlan (for Index Scan)

106. 0.177 0.177 ↑ 1.0 1 59

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific sff (cost=0.43..8.45 rows=1 width=1) (actual time=0.003..0.003 rows=1 loops=59)

  • Index Cond: ((fund_id = 3) AND (stock_id = sf.stock_id))
107. 0.329 0.329 ↑ 1.0 1 47

Index Scan using stock_fields_stock_id_ticker_idx on stock_fields (cost=0.42..8.44 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=47)

  • Index Cond: (stock_id = a1.id)
108. 0.007 0.007 ↓ 0.0 0 7

Index Scan using stock_fields_stock_id_ticker_idx on stock_fields stock_fields_1 (cost=0.42..8.44 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=7)

  • Index Cond: (stock_id = a4.stock_id)
109. 0.042 0.042 ↑ 1.0 1 7

Index Scan using private_company_fields_id_idx on private_company_fields (cost=0.43..8.45 rows=1 width=6) (actual time=0.006..0.006 rows=1 loops=7)

  • Index Cond: (id = a4.id)
110. 0.105 0.987 ↑ 1.0 1 47

Aggregate (cost=1,508.94..1,508.95 rows=1 width=32) (actual time=0.021..0.021 rows=1 loops=47)

111. 0.117 0.705 ↑ 21.0 1 47

Nested Loop Left Join (cost=9.72..471.62 rows=21 width=27) (actual time=0.004..0.015 rows=1 loops=47)

112. 0.188 0.470 ↑ 21.0 1 47

Nested Loop Left Join (cost=9.29..430.67 rows=21 width=20) (actual time=0.003..0.010 rows=1 loops=47)

113. 0.070 0.282 ↑ 21.0 1 47

Nested Loop (cost=0.71..247.23 rows=21 width=4) (actual time=0.002..0.006 rows=1 loops=47)

114. 0.094 0.094 ↑ 21.0 1 47

Index Scan using stock_fields_parent_stock_id_idx on stock_fields x4 (cost=0.42..72.71 rows=21 width=4) (actual time=0.002..0.002 rows=1 loops=47)

  • Index Cond: (parent_stock_id = a1.id)
115. 0.118 0.118 ↑ 1.0 1 59

Index Scan using stocks_pkey on stocks x1 (cost=0.29..8.31 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=59)

  • Index Cond: (id = x4.stock_id)
116. 0.000 0.000 ↓ 0.0 0 59

Index Scan using trade_requests_pkey on trade_requests x2 (cost=8.58..8.74 rows=1 width=20) (actual time=0.000..0.000 rows=0 loops=59)

  • Index Cond: (id = (SubPlan 9))
117.          

SubPlan (for Index Scan)

118. 0.059 0.059 ↓ 0.0 0 59

Index Scan using active_trades_status_idx on trade_requests trade_requests_3 (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=59)

  • Index Cond: ((stock_id = x1.id) AND (fund_id = 3))
119. 0.118 0.118 ↑ 1.0 1 59

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific x3 (cost=0.43..1.95 rows=1 width=11) (actual time=0.002..0.002 rows=1 loops=59)

  • Index Cond: ((fund_id = 3) AND (stock_id = x1.id))
120.          

SubPlan (for Aggregate)

121. 0.000 0.059 ↓ 0.0 0 59

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual time=0.001..0.001 rows=0 loops=59)

122. 0.059 0.059 ↓ 0.0 0 59

Index Only Scan using active_trades_status_idx on trade_requests (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=59)

  • Index Cond: ((stock_id = x1.id) AND (fund_id = 3))
  • Heap Fetches: 0
123. 0.000 0.000 ↓ 0.0 0

Index Scan using tag_values_pkey on tag_values (cost=0.29..8.30 rows=1 width=15) (never executed)

  • Index Cond: (id = trade_requests.status)
124. 0.059 0.118 ↓ 0.0 0 59

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=59)

125. 0.059 0.059 ↓ 0.0 0 59

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_1 (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=59)

  • Index Cond: ((stock_id = x1.id) AND (fund_id = 3))
  • Heap Fetches: 0
126. 0.000 0.000 ↓ 0.0 0

Index Scan using tag_values_pkey on tag_values tag_values_1 (cost=0.29..8.30 rows=1 width=15) (never executed)

  • Index Cond: (id = trade_requests_1.status)
127. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (never executed)

128. 0.000 0.000 ↓ 0.0 0

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_2 (cost=0.14..8.16 rows=1 width=4) (never executed)

  • Index Cond: ((stock_id = x1.id) AND (fund_id = 3))
  • Heap Fetches: 0
129. 0.000 0.000 ↓ 0.0 0

Index Scan using tag_values_pkey on tag_values tag_values_2 (cost=0.29..8.30 rows=1 width=15) (never executed)

  • Index Cond: (id = trade_requests_2.status)
130. 0.076 0.138 ↓ 0.0 0 46

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual time=0.002..0.003 rows=0 loops=46)

131. 0.046 0.046 ↓ 0.0 0 46

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_4 (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=46)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
  • Heap Fetches: 4
132. 0.016 0.016 ↑ 1.0 1 4

Index Scan using tag_values_pkey on tag_values tag_values_3 (cost=0.29..8.30 rows=1 width=15) (actual time=0.004..0.004 rows=1 loops=4)

  • Index Cond: (id = trade_requests_4.status)
133. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=8.45..8.46 rows=1 width=32) (never executed)

134. 0.000 0.000 ↓ 0.0 0

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific (cost=0.43..8.45 rows=1 width=7) (never executed)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id))
135. 0.038 0.092 ↓ 0.0 0 46

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=46)

136. 0.046 0.046 ↓ 0.0 0 46

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_5 (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=46)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
  • Heap Fetches: 4
137. 0.008 0.008 ↑ 1.0 1 4

Index Scan using tag_values_pkey on tag_values tag_values_4 (cost=0.29..8.30 rows=1 width=15) (actual time=0.002..0.002 rows=1 loops=4)

  • Index Cond: (id = trade_requests_5.status)
138. 0.084 0.336 ↑ 1.0 1 42

Aggregate (cost=8.45..8.46 rows=1 width=32) (actual time=0.008..0.008 rows=1 loops=42)

139. 0.252 0.252 ↑ 1.0 1 42

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific stock_fields_fund_specific_1 (cost=0.43..8.45 rows=1 width=7) (actual time=0.006..0.006 rows=1 loops=42)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id))
140. 0.054 0.054 ↓ 1.1 94 1

Index Only Scan using stock_fields_parent_stock_id_idx on stock_fields stock_fields_2 (cost=0.42..25.94 rows=85 width=4) (actual time=0.009..0.054 rows=94 loops=1)

  • Index Cond: (parent_stock_id IS NOT NULL)
  • Heap Fetches: 33
141. 0.002 0.125 ↑ 1.0 1 1

Aggregate (cost=176.36..176.37 rows=1 width=32) (actual time=0.125..0.125 rows=1 loops=1)

142. 0.001 0.123 ↓ 0.0 0 1

Nested Loop Left Join (cost=0.98..176.35 rows=1 width=15) (actual time=0.123..0.123 rows=0 loops=1)

143. 0.021 0.122 ↓ 0.0 0 1

Nested Loop (cost=0.55..168.14 rows=1 width=16) (actual time=0.122..0.122 rows=0 loops=1)

144. 0.042 0.042 ↓ 2.8 59 1

Index Scan using stock_fields_parent_stock_id_idx on stock_fields b2 (cost=0.42..72.71 rows=21 width=4) (actual time=0.005..0.042 rows=59 loops=1)

  • Index Cond: (parent_stock_id = a1.id)
145. 0.059 0.059 ↓ 0.0 0 59

Index Scan using active_trades_status_idx on trade_requests b1 (cost=0.14..4.54 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=59)

  • Index Cond: ((stock_id = b2.stock_id) AND (fund_id = 3))
  • Filter: ((status IS NULL) OR (status <> ALL ('{1400,1403,1404,10882}'::integer[])))
146. 0.000 0.000 ↓ 0.0 0

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific b3 (cost=0.43..8.21 rows=1 width=15) (never executed)

  • Index Cond: ((b1.fund_id = fund_id) AND (fund_id = 3) AND (b1.stock_id = stock_id))
147. 0.038 0.092 ↓ 0.0 0 46

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=46)

148. 0.046 0.046 ↓ 0.0 0 46

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_6 (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=46)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
  • Heap Fetches: 4
149. 0.008 0.008 ↑ 1.0 1 4

Index Scan using tag_values_pkey on tag_values tag_values_5 (cost=0.29..8.30 rows=1 width=15) (actual time=0.002..0.002 rows=1 loops=4)

  • Index Cond: (id = trade_requests_6.status)
150. 0.046 0.046 ↓ 0.0 0 46

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific stock_fields_fund_specific_2 (cost=0.43..8.45 rows=1 width=7) (actual time=0.001..0.001 rows=0 loops=46)

  • Index Cond: ((fund_id = a8.fund_id) AND (stock_id = a8.stock_id))
151. 0.039 0.094 ↓ 0.0 0 47

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=47)

152. 0.047 0.047 ↓ 0.0 0 47

Index Only Scan using active_trades_status_idx on trade_requests trade_requests_7 (cost=0.14..8.16 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=47)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
  • Heap Fetches: 4
153. 0.008 0.008 ↑ 1.0 1 4

Index Scan using tag_values_pkey on tag_values tag_values_6 (cost=0.29..8.30 rows=1 width=15) (actual time=0.002..0.002 rows=1 loops=4)

  • Index Cond: (id = trade_requests_7.status)
154. 0.375 3.290 ↑ 1.0 1 47

Aggregate (cost=795.67..795.69 rows=1 width=32) (actual time=0.070..0.070 rows=1 loops=47)

155. 0.046 1.034 ↑ 16.0 1 47

Nested Loop (cost=1.71..421.10 rows=16 width=23) (actual time=0.004..0.022 rows=1 loops=47)

156. 0.117 0.752 ↑ 20.0 1 47

Nested Loop (cost=1.14..257.36 rows=20 width=27) (actual time=0.003..0.016 rows=1 loops=47)

  • Join Filter: (sf_1.stock_id = s.id)
157. 0.058 0.517 ↑ 20.0 1 47

Nested Loop (cost=0.85..250.17 rows=20 width=27) (actual time=0.002..0.011 rows=1 loops=47)

158. 0.282 0.282 ↑ 21.0 1 47

Index Scan using stock_fields_parent_stock_id_idx on stock_fields sf_1 (cost=0.42..72.71 rows=21 width=12) (actual time=0.002..0.006 rows=1 loops=47)

  • Index Cond: (parent_stock_id = a1.id)
159. 0.177 0.177 ↑ 1.0 1 59

Index Scan using stock_fields_fund_specific_fund_stock_idx on stock_fields_fund_specific sff_1 (cost=0.43..8.45 rows=1 width=15) (actual time=0.003..0.003 rows=1 loops=59)

  • Index Cond: ((fund_id = 3) AND (stock_id = sf_1.stock_id))
160. 0.118 0.118 ↑ 1.0 1 59

Index Scan using stocks_pkey on stocks s (cost=0.29..0.35 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=59)

  • Index Cond: (id = sff_1.stock_id)
161. 0.236 0.236 ↑ 1.0 1 59

Index Scan using entities_pkey on entities e (cost=0.57..8.19 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=59)

  • Index Cond: (id = s.entity_id)
  • Filter: (archive_on IS NULL)
162.          

SubPlan (for Aggregate)

163. 0.216 0.232 ↑ 1.0 1 58

Index Scan using positions_fund_id_stock_id_date_id_key on positions positions_1 (cost=0.78..8.80 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=58)

  • Index Cond: ((fund_id = sff_1.fund_id) AND (stock_id = sf_1.stock_id) AND (date_id = $42))
164.          

Initplan (for Index Scan)

165. 0.001 0.016 ↑ 1.0 1 1

Limit (cost=0.30..0.35 rows=1 width=8) (actual time=0.015..0.016 rows=1 loops=1)

166. 0.015 0.015 ↑ 29,866.0 1 1

Index Scan Backward using dates_date_idx on dates dates_1 (cost=0.30..1,421.72 rows=29,866 width=8) (actual time=0.015..0.015 rows=1 loops=1)

  • Index Cond: (date <= (timezone('America/New_York'::text, now()))::date)
  • Filter: is_coatue_trading_day
167. 0.161 0.174 ↑ 1.0 1 58

Index Scan using positions_fund_id_stock_id_date_id_key on positions (cost=0.78..8.80 rows=1 width=32) (actual time=0.002..0.003 rows=1 loops=58)

  • Index Cond: ((fund_id = sff_1.fund_id) AND (stock_id = sf_1.stock_id) AND (date_id = $33))
168.          

Initplan (for Index Scan)

169. 0.001 0.013 ↑ 1.0 1 1

Limit (cost=0.30..0.35 rows=1 width=8) (actual time=0.012..0.013 rows=1 loops=1)

170. 0.012 0.012 ↑ 29,866.0 1 1

Index Scan Backward using dates_date_idx on dates (cost=0.30..1,421.72 rows=29,866 width=8) (actual time=0.011..0.012 rows=1 loops=1)

  • Index Cond: (date <= (timezone('America/New_York'::text, now()))::date)
  • Filter: is_coatue_trading_day
171. 0.118 0.649 ↑ 1.0 1 59

Limit (cost=0.57..2.88 rows=1 width=26) (actual time=0.010..0.011 rows=1 loops=59)

172. 0.531 0.531 ↑ 8,398.0 1 59

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw (cost=0.57..19,396.32 rows=8,398 width=26) (actual time=0.009..0.009 rows=1 loops=59)

  • Index Cond: ((stock_id = CASE WHEN (sf_1.tag__605 = ANY ('{1307,1306}'::integer[])) THEN sf_1.underlying_equity_id ELSE sf_1.stock_id END) AND (price_date <= CURRENT_DATE))
173. 0.059 0.826 ↑ 1.0 1 59

Limit (cost=0.58..2.90 rows=1 width=26) (actual time=0.014..0.014 rows=1 loops=59)

174. 0.767 0.767 ↑ 347.0 1 59

Index Scan using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_1 (cost=0.58..805.88 rows=347 width=26) (actual time=0.012..0.013 rows=1 loops=59)

  • Index Cond: ((stock_id = CASE WHEN (sf_1.tag__605 = ANY ('{1307,1306}'::integer[])) THEN sf_1.underlying_equity_id ELSE sf_1.stock_id END) AND (price_date >= date_trunc('year'::text, (CURRENT_DATE)::timestamp with time zone)))
175. 0.014 0.063 ↓ 0.0 0 7

Limit (cost=0.58..2.90 rows=1 width=26) (actual time=0.009..0.009 rows=0 loops=7)

176. 0.049 0.049 ↓ 0.0 0 7

Index Scan using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_2 (cost=0.58..805.88 rows=347 width=26) (actual time=0.007..0.007 rows=0 loops=7)

  • Index Cond: ((stock_id = a1.id) AND (price_date >= date_trunc('year'::text, (CURRENT_DATE)::timestamp with time zone)))
177. 1.964 8.084 ↑ 1.0 1 47

Aggregate (cost=169.33..169.34 rows=1 width=32) (actual time=0.172..0.172 rows=1 loops=47)

178.          

Initplan (for Aggregate)

179. 0.010 0.010 ↑ 1.0 1 1

Index Scan using dates_date_is_coatue_trading_day_idx on dates dates_2 (cost=0.30..8.32 rows=1 width=4) (actual time=0.010..0.010 rows=1 loops=1)

  • Index Cond: (date = make_date((date_part('year'::text, (CURRENT_DATE)::timestamp without time zone))::integer, 1, 1))
180. 6.110 6.110 ↓ 2.7 122 47

Index Scan using positions_fund_id_stock_id_date_id_key on positions positions_2 (cost=0.43..160.90 rows=45 width=6) (actual time=0.007..0.130 rows=122 loops=47)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id) AND (date_id >= $50))
181. 0.188 0.517 ↑ 1.0 1 47

Result (cost=33.71..33.74 rows=1 width=32) (actual time=0.011..0.011 rows=1 loops=47)

182.          

Initplan (for Result)

183. 0.160 0.188 ↑ 1.0 1 47

Index Scan using positions_fund_id_stock_id_date_id_key on positions positions_3 (cost=8.93..16.95 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=47)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id) AND (date_id = $53))
184.          

Initplan (for Index Scan)

185. 0.002 0.028 ↑ 1.0 1 1

Limit (cost=8.50..8.50 rows=1 width=4) (actual time=0.027..0.028 rows=1 loops=1)

186. 0.008 0.026 ↑ 6.0 1 1

Sort (cost=8.50..8.51 rows=6 width=4) (actual time=0.026..0.026 rows=1 loops=1)

  • Sort Key: dates_3.id DESC
  • Sort Method: top-N heapsort Memory: 25kB
187. 0.018 0.018 ↑ 1.0 6 1

Index Scan using dates_date_idx on dates dates_3 (cost=0.31..8.47 rows=6 width=4) (actual time=0.015..0.018 rows=6 loops=1)

  • Index Cond: ((date <= (timezone('America/New_York'::text, now()))::date) AND (date >= ((timezone('America/New_York'::text, now()))::date - 7)))
  • Filter: is_coatue_trading_day
  • Rows Removed by Filter: 2
188. 0.136 0.141 ↑ 1.0 1 47

Index Scan using positions_fund_id_stock_id_date_id_key on positions positions_4 (cost=8.74..16.76 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=47)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id) AND (date_id = $56))
189.          

Initplan (for Index Scan)

190. 0.005 0.005 ↑ 1.0 1 1

Index Scan using dates_date_is_coatue_trading_day_idx on dates dates_4 (cost=0.29..8.31 rows=1 width=4) (actual time=0.004..0.005 rows=1 loops=1)

  • Index Cond: (date = '2020-09-01'::date)
191. 0.137 0.141 ↑ 1.0 1 47

Index Scan using positions_fund_id_stock_id_date_id_key on positions positions_5 (cost=8.74..16.77 rows=1 width=6) (actual time=0.003..0.003 rows=1 loops=47)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id) AND (date_id = $58))
192.          

Initplan (for Index Scan)

193. 0.004 0.004 ↑ 1.0 1 1

Index Scan using dates_date_is_coatue_trading_day_idx on dates dates_5 (cost=0.30..8.31 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1)

  • Index Cond: (date = (timezone('EST'::text, now()))::date)
194. 0.047 0.282 ↑ 1.0 1 47

Limit (cost=0.57..2.88 rows=1 width=26) (actual time=0.005..0.006 rows=1 loops=47)

195. 0.235 0.235 ↑ 8,401.0 1 47

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_4 (cost=0.57..19,382.21 rows=8,401 width=26) (actual time=0.005..0.005 rows=1 loops=47)

  • Index Cond: (stock_id = a2.countryindextickerid)
196. 0.094 0.235 ↑ 1.0 1 47

Limit (cost=0.58..2.89 rows=1 width=26) (actual time=0.005..0.005 rows=1 loops=47)

197. 0.141 0.141 ↑ 8,358.0 1 47

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_5 (cost=0.58..19,304.30 rows=8,358 width=26) (actual time=0.003..0.003 rows=1 loops=47)

  • Index Cond: ((stock_id = a2.countryindextickerid) AND (price_date <= ((CURRENT_DATE - '1 mon'::interval))::date))
198. 0.094 0.188 ↑ 1.0 1 47

Bitmap Heap Scan on price_history_cache (cost=4.43..8.44 rows=1 width=7) (actual time=0.004..0.004 rows=1 loops=47)

  • Recheck Cond: (stock_id = a2.countryindextickerid)
  • Heap Blocks: exact=41
199. 0.094 0.094 ↑ 1.0 1 47

Bitmap Index Scan on price_history_cache_stock_id_idx1 (cost=0.00..4.43 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=47)

  • Index Cond: (stock_id = a2.countryindextickerid)
200. 0.094 0.141 ↑ 1.0 1 47

Bitmap Heap Scan on price_history_cache price_history_cache_1 (cost=4.43..8.44 rows=1 width=6) (actual time=0.002..0.003 rows=1 loops=47)

  • Recheck Cond: (stock_id = a2.countryindextickerid)
  • Heap Blocks: exact=41
201. 0.047 0.047 ↑ 1.0 1 47

Bitmap Index Scan on price_history_cache_stock_id_idx1 (cost=0.00..4.43 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=47)

  • Index Cond: (stock_id = a2.countryindextickerid)
202. 0.047 0.094 ↑ 1.0 1 47

Bitmap Heap Scan on price_history_cache price_history_cache_2 (cost=4.43..8.44 rows=1 width=7) (actual time=0.002..0.002 rows=1 loops=47)

  • Recheck Cond: (stock_id = a2.countryindextickerid)
  • Heap Blocks: exact=41
203. 0.047 0.047 ↑ 1.0 1 47

Bitmap Index Scan on price_history_cache_stock_id_idx1 (cost=0.00..4.43 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=47)

  • Index Cond: (stock_id = a2.countryindextickerid)
204. 0.047 0.094 ↑ 1.0 1 47

Bitmap Heap Scan on price_history_cache price_history_cache_3 (cost=4.43..8.44 rows=1 width=7) (actual time=0.002..0.002 rows=1 loops=47)

  • Recheck Cond: (stock_id = a2.countryindextickerid)
  • Heap Blocks: exact=41
205. 0.047 0.047 ↑ 1.0 1 47

Bitmap Index Scan on price_history_cache_stock_id_idx1 (cost=0.00..4.43 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=47)

  • Index Cond: (stock_id = a2.countryindextickerid)
206. 0.047 0.329 ↑ 1.0 1 47

Limit (cost=0.57..3.40 rows=1 width=26) (actual time=0.007..0.007 rows=1 loops=47)

207. 0.282 0.282 ↑ 11.0 1 47

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_6 (cost=0.57..31.60 rows=11 width=26) (actual time=0.005..0.006 rows=1 loops=47)

  • Index Cond: ((stock_id = a1.id) AND (price_date >= (CURRENT_DATE - 7)))
208. 0.141 0.517 ↑ 1.0 1 47

Aggregate (cost=15.85..15.86 rows=1 width=8) (actual time=0.011..0.011 rows=1 loops=47)

209. 0.141 0.376 ↑ 1.0 3 47

Bitmap Heap Scan on fe_v4_fe_basic_conh_qf_ny_mat (cost=4.45..15.85 rows=3 width=8) (actual time=0.007..0.008 rows=3 loops=47)

  • Recheck Cond: ((stock_id = a1.id) AND ((fe_item)::text = 'EPS'::text))
  • Heap Blocks: exact=58
210. 0.235 0.235 ↑ 1.0 3 47

Bitmap Index Scan on fe_v4_fe_basic_conh_qf_ny_mat_stock_item_idx (cost=0.00..4.45 rows=3 width=0) (actual time=0.005..0.005 rows=3 loops=47)

  • Index Cond: ((stock_id = a1.id) AND ((fe_item)::text = 'EPS'::text))
211. 1.175 1.457 ↑ 1.0 1 47

Seq Scan on currencies (cost=4.72..8.03 rows=1 width=6) (actual time=0.024..0.031 rows=1 loops=47)

  • Filter: (currency = ($69)::text)
  • Rows Removed by Filter: 86
212.          

Initplan (for Seq Scan)

213. 0.047 0.282 ↑ 1.0 1 47

Limit (cost=0.42..4.72 rows=1 width=4) (actual time=0.005..0.006 rows=1 loops=47)

214. 0.235 0.235 ↑ 14.0 1 47

Index Scan using fe_v4_fe_basic_conh_af_n8y_mat_stock_item_idx on fe_v4_fe_basic_conh_af_n8y_mat (cost=0.42..60.62 rows=14 width=4) (actual time=0.005..0.005 rows=1 loops=47)

  • Index Cond: (stock_id = a1.id)
215. 0.282 0.282 ↑ 1.0 1 47

Index Scan using stock_company_fields_mat_fsym_id_idx on stock_company_fields_mat (cost=0.29..8.31 rows=1 width=25) (actual time=0.006..0.006 rows=1 loops=47)

  • Index Cond: (fsym_id = a10.fsym_id)
Planning time : 27.930 ms
Execution time : 2,999.683 ms