explain.depesz.com

PostgreSQL's explain analyze made readable

Result: BBz

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Limit (cost=1,369,526.80..102,786,214.37 rows=31,841 width=608) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Result (cost=1,369,526.80..102,786,214.37 rows=31,841 width=608) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Sort (cost=1,369,461.37..1,369,540.97 rows=31,841 width=335) (actual rows= loops=)

  • Sort Key: (CASE WHEN a5.idealperfectlysized__srf THEN a5.equity_pct__apc ELSE a5.idealsize__srf END) DESC NULLS LAST, a1.id
4. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=68,993.75..1,362,179.89 rows=31,841 width=335) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=68,993.45..1,337,575.48 rows=31,841 width=180) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=68,993.02..1,273,814.40 rows=31,841 width=170) (actual rows= loops=)

  • Hash Cond: ((SubPlan 45) = a8.id)
7. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=62,265.63..1,251,729.27 rows=31,841 width=154) (actual rows= loops=)

  • Hash Cond: ((SubPlan 44) = a7.id)
  • Filter: (((a5.equity_pct__apc > '0'::numeric) AND (a5.equity_pct__apc IS NOT NULL)) OR ((COALESCE((SubPlan 50), CASE WHEN (((SubPlan 51) = ANY ('{Hold,""No Trade"",Cancelled,Completed}'::text[])) OR (CASE WHEN ((a7.request_end IS NULL) AND ((SubPlan 52) <> ALL ('{Hold,""No Trade""}'::text[]))) THEN a7.target_size ELSE NULL::numeric END IS NULL)) THEN (SubPlan 53) ELSE COALESCE(CASE WHEN ((a7.request_end IS NULL) AND ((SubPlan 54) <> ALL ('{Hold,""No Trade""}'::text[]))) THEN a7.target_size ELSE NULL::numeric END, 0.0) END) >= 0.0002) AND (COALESCE((SubPlan 59), CASE WHEN (((SubPlan 60) = ANY ('{Hold,""No Trade"",Cancelled,Completed}'::text[])) OR (CASE WHEN ((a7.request_end IS NULL) AND ((SubPlan 61) <> ALL ('{Hold,""No Trade""}'::text[]))) THEN a7.target_size ELSE NULL::numeric END IS NULL)) THEN (SubPlan 62) ELSE COALESCE(CASE WHEN ((a7.request_end IS NULL) AND ((SubPlan 63) <> ALL ('{Hold,""No Trade""}'::text[]))) THEN a7.target_size ELSE NULL::numeric END, 0.0) END) 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)))
8. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=55,538.23..1,206,229.25 rows=57,545 width=138) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=55,537.81..932,390.67 rows=50,580 width=91) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=55,537.39..650,866.35 rows=50,580 width=87) (actual rows= loops=)

  • Hash Cond: (a1.id = a11.stock_id)
11. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=53,669.77..648,865.95 rows=50,580 width=78) (actual rows= loops=)

  • Filter: (a12.archive_on IS NULL)
12. 0.000 0.000 ↓ 0.0

Hash Join (cost=53,669.20..114,866.27 rows=65,182 width=82) (actual rows= loops=)

  • Hash Cond: (a1.id = a2.stock_id)
13. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=19,536.09..78,810.83 rows=85,074 width=22) (actual rows= loops=)

  • Hash Cond: (a1.id = a10.stock_id)
14. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=2,973.86..60,695.27 rows=85,074 width=18) (actual rows= loops=)

  • Hash Cond: (a5.stock_id = a1.id)
15. 0.000 0.000 ↓ 0.0

Seq Scan on stock_fields_fund_specific a5 (cost=0.00..56,378.96 rows=81,307 width=14) (actual rows= loops=)

  • Filter: (fund_id = 3)
16. 0.000 0.000 ↓ 0.0

Hash (cost=1,577.44..1,577.44 rows=85,074 width=8) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Seq Scan on stocks a1 (cost=0.00..1,577.44 rows=85,074 width=8) (actual rows= loops=)

  • Filter: ((id IS NOT NULL) AND (id <> 87532))
18. 0.000 0.000 ↓ 0.0

Hash (cost=15,167.88..15,167.88 rows=84,988 width=8) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Seq Scan on stock_fields_extension2 a10 (cost=0.00..15,167.88 rows=84,988 width=8) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Hash (cost=32,617.33..32,617.33 rows=65,183 width=64) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Seq Scan on stock_fields a2 (cost=0.00..32,617.33 rows=65,183 width=64) (actual rows= loops=)

  • 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)))
22. 0.000 0.000 ↓ 0.0

Index Scan using entities_pkey on entities a12 (cost=0.57..8.18 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = a1.entity_id)
23. 0.000 0.000 ↓ 0.0

Hash (cost=1,085.05..1,085.05 rows=62,605 width=13) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Seq Scan on factset_mappings a11 (cost=0.00..1,085.05 rows=62,605 width=13) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Index Scan using private_company_fields_id_idx on private_company_fields a4 (cost=0.42..5.57 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = a2.private_company_id)
26. 0.000 0.000 ↓ 0.0

Index Scan using price_history_cache_pkey on price_history_cache a3 (cost=0.42..5.41 rows=1 width=51) (actual rows= loops=)

  • Index Cond: (stock_id = a1.id)
27. 0.000 0.000 ↓ 0.0

Hash (cost=4,050.51..4,050.51 rows=145,751 width=20) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Seq Scan on trade_requests a7 (cost=0.00..4,050.51 rows=145,751 width=20) (actual rows= loops=)

29.          

SubPlan (for Hash Left Join)

30. 0.000 0.000 ↓ 0.0

Aggregate (cost=1,572.45..1,572.46 rows=1 width=32) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9.72..485.73 rows=22 width=26) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9.29..465.89 rows=22 width=20) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.71..273.70 rows=22 width=4) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Index Scan using stock_fields_parent_stock_id_idx on stock_fields x4_1 (cost=0.42..90.88 rows=22 width=4) (actual rows= loops=)

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

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

  • Index Cond: (id = x4_1.stock_id)
36. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = (SubPlan 49))
37.          

SubPlan (for Index Scan)

38. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_14 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = x1_1.id) AND (fund_id = 3))
39. 0.000 0.000 ↓ 0.0

Index Only Scan using stock_fields_fund_specific_stock_fund_equity_idx on stock_fields_fund_specific x3_1 (cost=0.43..0.90 rows=1 width=10) (actual rows= loops=)

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

SubPlan (for Aggregate)

41. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual rows= loops=)

42. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_11 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = x1_1.id) AND (fund_id = 3))
43. 0.000 0.000 ↓ 0.0

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

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

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual rows= loops=)

45. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_12 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = x1_1.id) AND (fund_id = 3))
46. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = trade_requests_12.status)
47. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual rows= loops=)

48. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_13 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = x1_1.id) AND (fund_id = 3))
49. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = trade_requests_13.status)
50. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual rows= loops=)

51. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_15 (cost=0.14..12.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
52. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = trade_requests_15.status)
53. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual rows= loops=)

54. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_16 (cost=0.14..12.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
55. 0.000 0.000 ↓ 0.0

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

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

Aggregate (cost=9.06..9.07 rows=1 width=32) (actual rows= loops=)

57. 0.000 0.000 ↓ 0.0

Index Only Scan using stock_fields_fund_specific_stock_fund_equity_idx on stock_fields_fund_specific stock_fields_fund_specific_2 (cost=0.43..9.05 rows=2 width=6) (actual rows= loops=)

  • Index Cond: (stock_id = a1.id)
  • Filter: (fund_id = ANY ('{3,13}'::integer[]))
58. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual rows= loops=)

59. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_17 (cost=0.14..12.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
60. 0.000 0.000 ↓ 0.0

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

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

Aggregate (cost=1,572.45..1,572.46 rows=1 width=32) (actual rows= loops=)

62. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9.72..485.73 rows=22 width=26) (actual rows= loops=)

63. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9.29..465.89 rows=22 width=20) (actual rows= loops=)

64. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.71..273.70 rows=22 width=4) (actual rows= loops=)

65. 0.000 0.000 ↓ 0.0

Index Scan using stock_fields_parent_stock_id_idx on stock_fields x4_2 (cost=0.42..90.88 rows=22 width=4) (actual rows= loops=)

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

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

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

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

  • Index Cond: (id = (SubPlan 58))
68.          

SubPlan (for Index Scan)

69. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_21 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

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

Index Only Scan using stock_fields_fund_specific_stock_fund_equity_idx on stock_fields_fund_specific x3_2 (cost=0.43..0.90 rows=1 width=10) (actual rows= loops=)

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

SubPlan (for Aggregate)

72. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual rows= loops=)

73. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_18 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

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

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

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

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual rows= loops=)

76. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_19 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

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

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

  • Index Cond: (id = trade_requests_19.status)
78. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual rows= loops=)

79. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_20 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

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

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

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

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual rows= loops=)

82. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_22 (cost=0.14..12.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
83. 0.000 0.000 ↓ 0.0

Index Scan using tag_values_pkey on tag_values tag_values_17 (cost=0.29..8.30 rows=1 width=15) (actual rows= loops=)

  • Index Cond: (id = trade_requests_22.status)
84. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual rows= loops=)

85. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_23 (cost=0.14..12.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
86. 0.000 0.000 ↓ 0.0

Index Scan using tag_values_pkey on tag_values tag_values_18 (cost=0.29..8.30 rows=1 width=15) (actual rows= loops=)

  • Index Cond: (id = trade_requests_23.status)
87. 0.000 0.000 ↓ 0.0

Aggregate (cost=9.06..9.07 rows=1 width=32) (actual rows= loops=)

88. 0.000 0.000 ↓ 0.0

Index Only Scan using stock_fields_fund_specific_stock_fund_equity_idx on stock_fields_fund_specific stock_fields_fund_specific_3 (cost=0.43..9.05 rows=2 width=6) (actual rows= loops=)

  • Index Cond: (stock_id = a1.id)
  • Filter: (fund_id = ANY ('{3,13}'::integer[]))
89. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual rows= loops=)

90. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_24 (cost=0.14..12.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
91. 0.000 0.000 ↓ 0.0

Index Scan using tag_values_pkey on tag_values tag_values_19 (cost=0.29..8.30 rows=1 width=15) (actual rows= loops=)

  • Index Cond: (id = trade_requests_24.status)
92. 0.000 0.000 ↓ 0.0

Limit (cost=0.14..12.30 rows=1 width=4) (actual rows= loops=)

93. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_9 (cost=0.14..12.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
94. 0.000 0.000 ↓ 0.0

Hash (cost=4,050.51..4,050.51 rows=145,751 width=20) (actual rows= loops=)

95. 0.000 0.000 ↓ 0.0

Seq Scan on trade_requests a8 (cost=0.00..4,050.51 rows=145,751 width=20) (actual rows= loops=)

96.          

SubPlan (for Hash Left Join)

97. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_10 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

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

Index Scan using stock_fields_fund_specific_stock_id_fund_id_key on stock_fields_fund_specific a6 (cost=0.43..2.00 rows=1 width=14) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 4))
99. 0.000 0.000 ↓ 0.0

Index Scan using stock_fields_extension_stock_id_idx on stock_fields_extension a9 (cost=0.29..0.77 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (stock_id = a1.id)
100.          

SubPlan (for Result)

101. 0.000 0.000 ↓ 0.0

Aggregate (cost=276.95..276.96 rows=1 width=32) (actual rows= loops=)

102. 0.000 0.000 ↓ 0.0

Index Scan using stock_fields_parent_stock_id_idx on stock_fields sf (cost=0.42..276.84 rows=11 width=12) (actual rows= loops=)

  • Index Cond: (parent_stock_id = a1.id)
  • Filter: (SubPlan 1)
103.          

SubPlan (for Index Scan)

104. 0.000 0.000 ↓ 0.0

Index Scan using stock_fields_fund_specific_stock_fund_equity_idx on stock_fields_fund_specific sff (cost=0.43..8.45 rows=1 width=1) (actual rows= loops=)

  • Index Cond: ((stock_id = sf.stock_id) AND (fund_id = 3))
105. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (stock_id = a1.id)
106. 0.000 0.000 ↓ 0.0

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 rows= loops=)

  • Index Cond: (stock_id = a4.stock_id)
107. 0.000 0.000 ↓ 0.0

Index Scan using private_company_fields_id_idx on private_company_fields (cost=0.42..8.44 rows=1 width=6) (actual rows= loops=)

  • Index Cond: (id = a4.id)
108. 0.000 0.000 ↓ 0.0

Aggregate (cost=1,572.45..1,572.46 rows=1 width=32) (actual rows= loops=)

109. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9.72..485.73 rows=22 width=26) (actual rows= loops=)

110. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9.29..465.89 rows=22 width=20) (actual rows= loops=)

111. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.71..273.70 rows=22 width=4) (actual rows= loops=)

112. 0.000 0.000 ↓ 0.0

Index Scan using stock_fields_parent_stock_id_idx on stock_fields x4 (cost=0.42..90.88 rows=22 width=4) (actual rows= loops=)

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

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

  • Index Cond: (id = x4.stock_id)
114. 0.000 0.000 ↓ 0.0

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

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

SubPlan (for Index Scan)

116. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_3 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = x1.id) AND (fund_id = 3))
117. 0.000 0.000 ↓ 0.0

Index Only Scan using stock_fields_fund_specific_stock_fund_equity_idx on stock_fields_fund_specific x3 (cost=0.43..0.90 rows=1 width=10) (actual rows= loops=)

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

SubPlan (for Aggregate)

119. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual rows= loops=)

120. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = x1.id) AND (fund_id = 3))
121. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = trade_requests.status)
122. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual rows= loops=)

123. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_1 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = x1.id) AND (fund_id = 3))
124. 0.000 0.000 ↓ 0.0

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

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

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual rows= loops=)

126. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_2 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = x1.id) AND (fund_id = 3))
127. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = trade_requests_2.status)
128. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual rows= loops=)

129. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_4 (cost=0.14..12.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
130. 0.000 0.000 ↓ 0.0

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

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

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual rows= loops=)

132. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_5 (cost=0.14..12.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
133. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = trade_requests_5.status)
134. 0.000 0.000 ↓ 0.0

Aggregate (cost=9.06..9.07 rows=1 width=32) (actual rows= loops=)

135. 0.000 0.000 ↓ 0.0

Index Only Scan using stock_fields_fund_specific_stock_fund_equity_idx on stock_fields_fund_specific (cost=0.43..9.05 rows=2 width=6) (actual rows= loops=)

  • Index Cond: (stock_id = a1.id)
  • Filter: (fund_id = ANY ('{3,13}'::integer[]))
136. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual rows= loops=)

137. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_6 (cost=0.14..12.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
138. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = trade_requests_6.status)
139. 0.000 0.000 ↓ 0.0

Index Only Scan using stock_fields_parent_stock_id_idx on stock_fields stock_fields_2 (cost=0.42..65.15 rows=111 width=4) (actual rows= loops=)

  • Index Cond: (parent_stock_id IS NOT NULL)
140. 0.000 0.000 ↓ 0.0

Aggregate (cost=194.84..194.85 rows=1 width=32) (actual rows= loops=)

141. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.98..194.83 rows=1 width=14) (actual rows= loops=)

142. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.55..190.47 rows=1 width=16) (actual rows= loops=)

143. 0.000 0.000 ↓ 0.0

Index Scan using stock_fields_parent_stock_id_idx on stock_fields b2 (cost=0.42..90.88 rows=22 width=4) (actual rows= loops=)

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

Index Scan using active_trades on trade_requests b1 (cost=0.14..4.53 rows=1 width=16) (actual rows= loops=)

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

Index Only Scan using stock_fields_fund_specific_stock_fund_equity_idx on stock_fields_fund_specific b3 (cost=0.43..4.36 rows=1 width=14) (actual rows= loops=)

  • Index Cond: ((stock_id = b1.stock_id) AND (fund_id = b1.fund_id) AND (fund_id = 3))
146. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual rows= loops=)

147. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_7 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

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

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

  • Index Cond: (id = trade_requests_7.status)
149. 0.000 0.000 ↓ 0.0

Index Only Scan using stock_fields_fund_specific_stock_fund_equity_idx on stock_fields_fund_specific stock_fields_fund_specific_1 (cost=0.43..8.45 rows=1 width=6) (actual rows= loops=)

  • Index Cond: ((stock_id = a8.stock_id) AND (fund_id = a8.fund_id))
150. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual rows= loops=)

151. 0.000 0.000 ↓ 0.0

Index Scan using active_trades on trade_requests trade_requests_8 (cost=0.14..8.16 rows=1 width=4) (actual rows= loops=)

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

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

  • Index Cond: (id = trade_requests_8.status)
153. 0.000 0.000 ↓ 0.0

Aggregate (cost=746.19..746.20 rows=1 width=32) (actual rows= loops=)

154. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.71..372.16 rows=16 width=22) (actual rows= loops=)

155. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.14..200.33 rows=21 width=26) (actual rows= loops=)

  • Join Filter: (sf_1.stock_id = s.id)
156. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..192.78 rows=21 width=26) (actual rows= loops=)

157. 0.000 0.000 ↓ 0.0

Index Scan using stock_fields_parent_stock_id_idx on stock_fields sf_1 (cost=0.42..90.88 rows=22 width=12) (actual rows= loops=)

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

Index Only Scan using stock_fields_fund_specific_stock_fund_equity_idx on stock_fields_fund_specific sff_1 (cost=0.43..4.63 rows=1 width=14) (actual rows= loops=)

  • Index Cond: ((stock_id = sf_1.stock_id) AND (fund_id = 3))
159. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = sff_1.stock_id)
160. 0.000 0.000 ↓ 0.0

Index Scan using entities_pkey on entities e (cost=0.57..8.18 rows=1 width=4) (actual rows= loops=)

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

SubPlan (for Aggregate)

162. 0.000 0.000 ↓ 0.0

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 rows= loops=)

  • Index Cond: ((fund_id = sff_1.fund_id) AND (stock_id = sf_1.stock_id) AND (date_id = $43))
163.          

Initplan (for Index Scan)

164. 0.000 0.000 ↓ 0.0

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

165. 0.000 0.000 ↓ 0.0

Index Scan Backward using dates_date_idx on dates dates_1 (cost=0.30..1,421.61 rows=29,862 width=8) (actual rows= loops=)

  • Index Cond: (date <= (timezone('America/New_York'::text, now()))::date)
  • Filter: is_coatue_trading_day
166. 0.000 0.000 ↓ 0.0

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

  • Index Cond: ((fund_id = sff_1.fund_id) AND (stock_id = sf_1.stock_id) AND (date_id = $34))
167.          

Initplan (for Index Scan)

168. 0.000 0.000 ↓ 0.0

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

169. 0.000 0.000 ↓ 0.0

Index Scan Backward using dates_date_idx on dates (cost=0.30..1,421.61 rows=29,862 width=8) (actual rows= loops=)

  • Index Cond: (date <= (timezone('America/New_York'::text, now()))::date)
  • Filter: is_coatue_trading_day
170. 0.000 0.000 ↓ 0.0

Limit (cost=0.57..2.87 rows=1 width=26) (actual rows= loops=)

171. 0.000 0.000 ↓ 0.0

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw (cost=0.57..19,293.89 rows=8,414 width=26) (actual rows= loops=)

  • 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))
172. 0.000 0.000 ↓ 0.0

Limit (cost=0.58..2.88 rows=1 width=26) (actual rows= loops=)

173. 0.000 0.000 ↓ 0.0

Index Scan using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_1 (cost=0.58..818.22 rows=355 width=26) (actual rows= loops=)

  • 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)))
174. 0.000 0.000 ↓ 0.0

Limit (cost=0.58..2.88 rows=1 width=26) (actual rows= loops=)

175. 0.000 0.000 ↓ 0.0

Index Scan using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_2 (cost=0.58..818.22 rows=355 width=26) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (price_date >= date_trunc('year'::text, (CURRENT_DATE)::timestamp with time zone)))
176. 0.000 0.000 ↓ 0.0

Aggregate (cost=168.53..168.54 rows=1 width=32) (actual rows= loops=)

177.          

Initplan (for Aggregate)

178. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (date = make_date((date_part('year'::text, (CURRENT_DATE)::timestamp without time zone))::integer, 1, 1))
179. 0.000 0.000 ↓ 0.0

Index Scan using positions_fund_id_stock_id_date_id_key on positions positions_2 (cost=0.43..160.09 rows=45 width=6) (actual rows= loops=)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id) AND (date_id >= $51))
180. 0.000 0.000 ↓ 0.0

Index Scan using positions_fund_id_stock_id_date_id_key on positions positions_3 (cost=8.74..16.77 rows=1 width=6) (actual rows= loops=)

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

Initplan (for Index Scan)

182. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (date = (timezone('EST'::text, now()))::date)
183. 0.000 0.000 ↓ 0.0

Limit (cost=0.57..2.86 rows=1 width=26) (actual rows= loops=)

184. 0.000 0.000 ↓ 0.0

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_3 (cost=0.57..19,272.85 rows=8,414 width=26) (actual rows= loops=)

  • Index Cond: (stock_id = a2.countryindextickerid)
185. 0.000 0.000 ↓ 0.0

Limit (cost=0.58..2.87 rows=1 width=26) (actual rows= loops=)

186. 0.000 0.000 ↓ 0.0

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_4 (cost=0.58..19,207.69 rows=8,378 width=26) (actual rows= loops=)

  • Index Cond: ((stock_id = a2.countryindextickerid) AND (price_date <= ((CURRENT_DATE - '1 mon'::interval))::date))
187. 0.000 0.000 ↓ 0.0

Limit (cost=0.57..2.86 rows=1 width=26) (actual rows= loops=)

188. 0.000 0.000 ↓ 0.0

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_5 (cost=0.57..19,272.85 rows=8,414 width=26) (actual rows= loops=)

  • Index Cond: (stock_id = a2.countryindextickerid)
189. 0.000 0.000 ↓ 0.0

Limit (cost=0.58..2.87 rows=1 width=26) (actual rows= loops=)

190. 0.000 0.000 ↓ 0.0

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_6 (cost=0.58..19,010.88 rows=8,292 width=26) (actual rows= loops=)

  • Index Cond: ((stock_id = a2.countryindextickerid) AND (price_date <= ((CURRENT_DATE - '3 mons'::interval))::date))
191. 0.000 0.000 ↓ 0.0

Limit (cost=0.57..2.86 rows=1 width=26) (actual rows= loops=)

192. 0.000 0.000 ↓ 0.0

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_7 (cost=0.57..19,272.85 rows=8,414 width=26) (actual rows= loops=)

  • Index Cond: (stock_id = a2.countryindextickerid)
193. 0.000 0.000 ↓ 0.0

Limit (cost=0.58..2.87 rows=1 width=26) (actual rows= loops=)

194. 0.000 0.000 ↓ 0.0

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_8 (cost=0.58..18,116.84 rows=7,900 width=26) (actual rows= loops=)

  • Index Cond: ((stock_id = a2.countryindextickerid) AND (price_date <= ((CURRENT_DATE - '1 year'::interval))::date))
195. 0.000 0.000 ↓ 0.0

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

196. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on fe_v4_fe_basic_conh_qf_ny_mat (cost=4.45..15.84 rows=3 width=8) (actual rows= loops=)

  • Recheck Cond: ((stock_id = a1.id) AND ((fe_item)::text = 'EPS'::text))
197. 0.000 0.000 ↓ 0.0

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 rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND ((fe_item)::text = 'EPS'::text))
198. 0.000 0.000 ↓ 0.0

Limit (cost=0.57..3.50 rows=1 width=26) (actual rows= loops=)

199. 0.000 0.000 ↓ 0.0

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_9 (cost=0.57..26.86 rows=9 width=26) (actual rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND (price_date >= (CURRENT_DATE - 7)))
200. 0.000 0.000 ↓ 0.0

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

201. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on fe_v4_fe_basic_conh_qf_ny_mat fe_v4_fe_basic_conh_qf_ny_mat_1 (cost=4.45..15.84 rows=3 width=8) (actual rows= loops=)

  • Recheck Cond: ((stock_id = a1.id) AND ((fe_item)::text = 'EPS'::text))
202. 0.000 0.000 ↓ 0.0

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 rows= loops=)

  • Index Cond: ((stock_id = a1.id) AND ((fe_item)::text = 'EPS'::text))
203. 0.000 0.000 ↓ 0.0

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

  • Filter: (currency = ($65)::text)
204.          

Initplan (for Seq Scan)

205. 0.000 0.000 ↓ 0.0

Limit (cost=0.42..4.72 rows=1 width=4) (actual rows= loops=)

206. 0.000 0.000 ↓ 0.0

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 rows= loops=)

  • Index Cond: (stock_id = a1.id)
207. 0.000 0.000 ↓ 0.0

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 rows= loops=)

  • Index Cond: (fsym_id = a11.fsym_id)