explain.depesz.com

PostgreSQL's explain analyze made readable

Result: M9j7

Settings
# exclusive inclusive rows x rows loops node
1. 0.024 4,702.653 ↑ 608.4 46 1

Limit (cost=1,353,037.45..90,494,359.49 rows=27,987 width=608) (actual time=4,683.149..4,702.653 rows=46 loops=1)

2. 1.500 4,702.629 ↑ 608.4 46 1

Result (cost=1,353,037.45..90,494,359.49 rows=27,987 width=608) (actual time=4,683.148..4,702.629 rows=46 loops=1)

3. 0.139 4,682.363 ↑ 608.4 46 1

Sort (cost=1,352,972.02..1,353,041.99 rows=27,987 width=335) (actual time=4,682.346..4,682.363 rows=46 loops=1)

  • Sort Key: (CASE WHEN a5.idealperfectlysized__srf THEN a5.equity_pct__apc ELSE a5.idealsize__srf END) DESC NULLS LAST, a1.id
  • Sort Method: quicksort Memory: 36kB
4. 0.149 4,682.224 ↑ 608.4 46 1

Nested Loop Left Join (cost=68,994.76..1,346,599.84 rows=27,987 width=335) (actual time=1,969.157..4,682.224 rows=46 loops=1)

5. 0.074 4,681.753 ↑ 608.4 46 1

Nested Loop Left Join (cost=68,994.47..1,324,973.52 rows=27,987 width=180) (actual time=1,969.129..4,681.753 rows=46 loops=1)

6. 9.819 4,681.403 ↑ 608.4 46 1

Hash Left Join (cost=68,994.04..1,268,930.01 rows=27,987 width=170) (actual time=1,969.110..4,681.403 rows=46 loops=1)

  • Hash Cond: ((SubPlan 45) = a8.id)
7. 482.299 4,569.274 ↑ 608.4 46 1

Hash Left Join (cost=62,266.64..1,248,600.95 rows=27,987 width=154) (actual time=1,866.572..4,569.274 rows=46 loops=1)

  • 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)))
  • Rows Removed by Filter: 57,517
8. 84.999 1,903.723 ↓ 1.1 57,563 1

Nested Loop Left Join (cost=55,539.24..1,207,690.43 rows=50,580 width=138) (actual time=715.834..1,903.723 rows=57,563 loops=1)

9. 90.228 1,818.724 ↓ 1.1 57,563 1

Nested Loop Left Join (cost=55,538.82..926,166.11 rows=50,580 width=134) (actual time=715.826..1,818.724 rows=57,563 loops=1)

10. 54.096 1,440.681 ↓ 1.1 57,563 1

Hash Left Join (cost=55,537.39..650,866.35 rows=50,580 width=87) (actual time=715.809..1,440.681 rows=57,563 loops=1)

  • Hash Cond: (a1.id = a11.stock_id)
11. 61.339 1,349.658 ↓ 1.1 57,563 1

Nested Loop Left Join (cost=53,669.77..648,865.95 rows=50,580 width=78) (actual time=678.632..1,349.658 rows=57,563 loops=1)

  • Filter: (a12.archive_on IS NULL)
  • Rows Removed by Filter: 7,538
12. 85.310 1,027.915 ↑ 1.0 65,101 1

Hash Join (cost=53,669.20..114,866.27 rows=65,182 width=82) (actual time=678.087..1,027.915 rows=65,101 loops=1)

  • Hash Cond: (a1.id = a2.stock_id)
13. 70.388 513.151 ↓ 1.0 85,089 1

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

  • Hash Cond: (a1.id = a10.stock_id)
14. 62.544 327.157 ↓ 1.0 85,089 1

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

  • Hash Cond: (a5.stock_id = a1.id)
15. 208.970 208.970 ↑ 1.0 79,514 1

Seq Scan on stock_fields_fund_specific a5 (cost=0.00..56,378.96 rows=81,307 width=14) (actual time=30.008..208.970 rows=79,514 loops=1)

  • Filter: (fund_id = 3)
  • Rows Removed by Filter: 2,321,343
16. 29.434 55.643 ↓ 1.0 85,089 1

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

  • Buckets: 131,072 Batches: 2 Memory Usage: 2,686kB
17. 26.209 26.209 ↓ 1.0 85,089 1

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

  • Filter: ((id IS NOT NULL) AND (id <> 87532))
  • Rows Removed by Filter: 1
18. 29.158 115.606 ↑ 1.0 84,988 1

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

  • Buckets: 131,072 Batches: 2 Memory Usage: 2,519kB
19. 86.448 86.448 ↑ 1.0 84,988 1

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

20. 39.943 429.454 ↑ 1.0 65,102 1

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

  • Buckets: 65,536 Batches: 2 Memory Usage: 3,464kB
21. 389.511 389.511 ↑ 1.0 65,102 1

Seq Scan on stock_fields a2 (cost=0.00..32,617.33 rows=65,183 width=64) (actual time=0.022..389.511 rows=65,102 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)))
  • Rows Removed by Filter: 19,988
22. 260.404 260.404 ↑ 1.0 1 65,101

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

  • Index Cond: (id = a1.entity_id)
23. 19.768 36.927 ↓ 1.0 62,607 1

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

  • Buckets: 65,536 Batches: 1 Memory Usage: 3,447kB
24. 17.159 17.159 ↓ 1.0 62,607 1

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

25. 115.126 287.815 ↑ 1.0 1 57,563

Bitmap Heap Scan on price_history_cache a3 (cost=1.43..5.44 rows=1 width=51) (actual time=0.005..0.005 rows=1 loops=57,563)

  • Recheck Cond: (stock_id = a1.id)
  • Heap Blocks: exact=46,938
26. 172.689 172.689 ↑ 1.0 1 57,563

Bitmap Index Scan on price_history_cache_pkey (cost=0.00..1.43 rows=1 width=0) (actual time=0.003..0.003 rows=1 loops=57,563)

  • Index Cond: (stock_id = a1.id)
27. 0.000 0.000 ↓ 0.0 0 57,563

Index Scan using private_company_fields_id_idx on private_company_fields a4 (cost=0.42..5.57 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=57,563)

  • Index Cond: (id = a2.private_company_id)
28. 51.056 113.502 ↑ 1.0 145,418 1

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

  • Buckets: 65,536 Batches: 4 Memory Usage: 2,253kB
29. 62.446 62.446 ↑ 1.0 145,418 1

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

30.          

SubPlan (for Hash Left Join)

31. 57.412 230.068 ↑ 1.0 1 57,517

Aggregate (cost=1,572.45..1,572.46 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=57,517)

32. 0.000 172.551 ↓ 0.0 0 57,517

Nested Loop Left Join (cost=9.72..485.73 rows=22 width=26) (actual time=0.003..0.003 rows=0 loops=57,517)

33. 57.517 172.551 ↓ 0.0 0 57,517

Nested Loop Left Join (cost=9.29..465.89 rows=22 width=20) (actual time=0.003..0.003 rows=0 loops=57,517)

34. 57.447 115.034 ↓ 0.0 0 57,517

Nested Loop (cost=0.71..273.70 rows=22 width=4) (actual time=0.002..0.002 rows=0 loops=57,517)

35. 57.517 57.517 ↓ 0.0 0 57,517

Index Scan using stock_fields_parent_stock_id_idx on stock_fields x4_1 (cost=0.42..90.88 rows=22 width=4) (actual time=0.001..0.001 rows=0 loops=57,517)

  • Index Cond: (parent_stock_id = a1.id)
36. 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)
37. 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 49))
38.          

SubPlan (for Index Scan)

39. 0.035 0.035 ↓ 0.0 0 35

Index Scan using active_trades on trade_requests trade_requests_14 (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))
40. 0.105 0.105 ↑ 1.0 1 35

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 time=0.003..0.003 rows=1 loops=35)

  • Index Cond: ((stock_id = x1_1.id) AND (fund_id = 3))
  • Heap Fetches: 0
41.          

SubPlan (for Aggregate)

42. 0.035 0.070 ↓ 0.0 0 35

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

43. 0.035 0.035 ↓ 0.0 0 35

Index Scan using active_trades 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))
44. 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)
45. 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)

46. 0.035 0.035 ↓ 0.0 0 35

Index Scan using active_trades on trade_requests trade_requests_12 (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))
47. 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)
48. 0.000 0.000 ↓ 0.0 0

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

49. 0.000 0.000 ↓ 0.0 0

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

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

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

  • Index Cond: (id = trade_requests_13.status)
51. 57.497 115.034 ↓ 0.0 0 57,517

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=57,517)

52. 57.517 57.517 ↓ 0.0 0 57,517

Index Scan using active_trades on trade_requests trade_requests_15 (cost=0.14..12.30 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=57,517)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
53. 0.020 0.020 ↑ 1.0 1 5

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

  • Index Cond: (id = trade_requests_15.status)
54. 57.507 115.034 ↓ 0.0 0 57,517

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=57,517)

55. 57.517 57.517 ↓ 0.0 0 57,517

Index Scan using active_trades on trade_requests trade_requests_16 (cost=0.14..12.30 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=57,517)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
56. 0.010 0.010 ↑ 1.0 1 5

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

  • Index Cond: (id = trade_requests_16.status)
57. 57.512 517.608 ↑ 1.0 1 57,512

Aggregate (cost=9.06..9.07 rows=1 width=32) (actual time=0.009..0.009 rows=1 loops=57,512)

58. 460.096 460.096 ↑ 1.0 2 57,512

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 time=0.004..0.008 rows=2 loops=57,512)

  • Index Cond: (stock_id = a1.id)
  • Filter: (fund_id = ANY ('{3,13}'::integer[]))
  • Rows Removed by Filter: 28
  • Heap Fetches: 1,125
59. 0.015 0.045 ↑ 1.0 1 5

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual time=0.007..0.009 rows=1 loops=5)

60. 0.020 0.020 ↑ 1.0 1 5

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
61. 0.010 0.010 ↑ 1.0 1 5

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

  • Index Cond: (id = trade_requests_17.status)
62. 57.348 229.812 ↑ 1.0 1 57,453

Aggregate (cost=1,572.45..1,572.46 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=57,453)

63. 0.000 172.359 ↓ 0.0 0 57,453

Nested Loop Left Join (cost=9.72..485.73 rows=22 width=26) (actual time=0.003..0.003 rows=0 loops=57,453)

64. 57.453 172.359 ↓ 0.0 0 57,453

Nested Loop Left Join (cost=9.29..465.89 rows=22 width=20) (actual time=0.003..0.003 rows=0 loops=57,453)

65. 57.383 114.906 ↓ 0.0 0 57,453

Nested Loop (cost=0.71..273.70 rows=22 width=4) (actual time=0.002..0.002 rows=0 loops=57,453)

66. 57.453 57.453 ↓ 0.0 0 57,453

Index Scan using stock_fields_parent_stock_id_idx on stock_fields x4_2 (cost=0.42..90.88 rows=22 width=4) (actual time=0.001..0.001 rows=0 loops=57,453)

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

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

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

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

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

SubPlan (for Index Scan)

70. 0.035 0.035 ↓ 0.0 0 35

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

  • Index Cond: ((stock_id = x1_2.id) AND (fund_id = 3))
71. 0.070 0.070 ↑ 1.0 1 35

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 time=0.002..0.002 rows=1 loops=35)

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

SubPlan (for Aggregate)

73. 0.035 0.070 ↓ 0.0 0 35

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

74. 0.035 0.035 ↓ 0.0 0 35

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

  • Index Cond: ((stock_id = x1_2.id) AND (fund_id = 3))
75. 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)
76. 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)

77. 0.035 0.035 ↓ 0.0 0 35

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

  • Index Cond: ((stock_id = x1_2.id) AND (fund_id = 3))
78. 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_19.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 Scan using active_trades on trade_requests trade_requests_20 (cost=0.14..8.16 rows=1 width=4) (never executed)

  • Index Cond: ((stock_id = x1_2.id) AND (fund_id = 3))
81. 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_20.status)
82. 57.453 114.906 ↓ 0.0 0 57,453

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=57,453)

83. 57.453 57.453 ↓ 0.0 0 57,453

Index Scan using active_trades on trade_requests trade_requests_22 (cost=0.14..12.30 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=57,453)

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

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

  • Index Cond: (id = trade_requests_22.status)
85. 57.453 114.906 ↓ 0.0 0 57,453

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=57,453)

86. 57.453 57.453 ↓ 0.0 0 57,453

Index Scan using active_trades on trade_requests trade_requests_23 (cost=0.14..12.30 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=57,453)

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

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

  • Index Cond: (id = trade_requests_23.status)
88. 114.906 459.624 ↑ 1.0 1 57,453

Aggregate (cost=9.06..9.07 rows=1 width=32) (actual time=0.008..0.008 rows=1 loops=57,453)

89. 344.718 344.718 ↑ 1.0 2 57,453

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 time=0.003..0.006 rows=2 loops=57,453)

  • Index Cond: (stock_id = a1.id)
  • Filter: (fund_id = ANY ('{3,13}'::integer[]))
  • Rows Removed by Filter: 28
  • Heap Fetches: 994
90. 0.000 0.000 ↓ 0.0 0

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

91. 0.000 0.000 ↓ 0.0 0

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

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

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

  • Index Cond: (id = trade_requests_24.status)
93. 57.571 172.713 ↓ 0.0 0 57,571

Limit (cost=0.14..12.30 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=57,571)

94. 115.142 115.142 ↓ 0.0 0 57,571

Index Scan using active_trades on trade_requests trade_requests_9 (cost=0.14..12.30 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=57,571)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
95. 52.040 102.261 ↑ 1.0 145,418 1

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

  • Buckets: 65,536 Batches: 4 Memory Usage: 2,290kB
96. 50.221 50.221 ↑ 1.0 145,418 1

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

97.          

SubPlan (for Hash Left Join)

98. 0.049 0.049 ↓ 0.0 0 49

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
99. 0.276 0.276 ↑ 1.0 1 46

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 time=0.006..0.006 rows=1 loops=46)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 4))
100. 0.322 0.322 ↑ 1.0 1 46

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

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

SubPlan (for Result)

102. 0.046 0.460 ↑ 1.0 1 46

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

103. 0.182 0.414 ↓ 0.0 0 46

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

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

SubPlan (for Index Scan)

105. 0.232 0.232 ↑ 1.0 1 58

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 time=0.003..0.004 rows=1 loops=58)

  • Index Cond: ((stock_id = sf.stock_id) AND (fund_id = 3))
106. 0.322 0.322 ↑ 1.0 1 46

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=46)

  • Index Cond: (stock_id = a1.id)
107. 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)
108. 0.042 0.042 ↑ 1.0 1 7

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

  • Index Cond: (id = a4.id)
109. 0.160 1.012 ↑ 1.0 1 46

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

110. 0.114 0.736 ↑ 22.0 1 46

Nested Loop Left Join (cost=9.72..485.73 rows=22 width=26) (actual time=0.004..0.016 rows=1 loops=46)

111. 0.184 0.506 ↑ 22.0 1 46

Nested Loop Left Join (cost=9.29..465.89 rows=22 width=20) (actual time=0.003..0.011 rows=1 loops=46)

112. 0.068 0.322 ↑ 22.0 1 46

Nested Loop (cost=0.71..273.70 rows=22 width=4) (actual time=0.003..0.007 rows=1 loops=46)

113. 0.138 0.138 ↑ 22.0 1 46

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

  • Index Cond: (parent_stock_id = a1.id)
114. 0.116 0.116 ↑ 1.0 1 58

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=58)

  • Index Cond: (id = x4.stock_id)
115. 0.000 0.000 ↓ 0.0 0 58

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=58)

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

SubPlan (for Index Scan)

117. 0.058 0.058 ↓ 0.0 0 58

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

  • Index Cond: ((stock_id = x1.id) AND (fund_id = 3))
118. 0.116 0.116 ↑ 1.0 1 58

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 time=0.002..0.002 rows=1 loops=58)

  • Index Cond: ((stock_id = x1.id) AND (fund_id = 3))
  • Heap Fetches: 49
119.          

SubPlan (for Aggregate)

120. 0.000 0.058 ↓ 0.0 0 58

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

121. 0.058 0.058 ↓ 0.0 0 58

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

  • Index Cond: ((stock_id = x1.id) AND (fund_id = 3))
122. 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)
123. 0.000 0.058 ↓ 0.0 0 58

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

124. 0.058 0.058 ↓ 0.0 0 58

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

  • Index Cond: ((stock_id = x1.id) AND (fund_id = 3))
125. 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)
126. 0.000 0.000 ↓ 0.0 0

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

127. 0.000 0.000 ↓ 0.0 0

Index Scan using active_trades 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))
128. 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)
129. 0.078 0.180 ↓ 0.0 0 45

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual time=0.004..0.004 rows=0 loops=45)

130. 0.090 0.090 ↓ 0.0 0 45

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
131. 0.012 0.012 ↑ 1.0 1 3

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=3)

  • Index Cond: (id = trade_requests_4.status)
132. 0.039 0.135 ↓ 0.0 0 45

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual time=0.003..0.003 rows=0 loops=45)

133. 0.090 0.090 ↓ 0.0 0 45

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
134. 0.006 0.006 ↑ 1.0 1 3

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=3)

  • Index Cond: (id = trade_requests_5.status)
135. 0.126 0.672 ↑ 1.0 1 42

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

136. 0.546 0.546 ↑ 1.0 2 42

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 time=0.007..0.013 rows=2 loops=42)

  • Index Cond: (stock_id = a1.id)
  • Filter: (fund_id = ANY ('{3,13}'::integer[]))
  • Rows Removed by Filter: 29
  • Heap Fetches: 159
137. 0.009 0.036 ↑ 1.0 1 3

Nested Loop (cost=0.42..20.61 rows=1 width=11) (actual time=0.010..0.012 rows=1 loops=3)

138. 0.009 0.009 ↑ 1.0 1 3

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = ANY ('{3,13}'::integer[])))
139. 0.018 0.018 ↑ 1.0 1 3

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

  • Index Cond: (id = trade_requests_6.status)
140. 0.056 0.056 ↑ 1.2 93 1

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 time=0.010..0.056 rows=93 loops=1)

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

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

142. 0.002 0.135 ↓ 0.0 0 1

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

143. 0.027 0.133 ↓ 0.0 0 1

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

144. 0.048 0.048 ↓ 2.6 58 1

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

  • Index Cond: (parent_stock_id = a1.id)
145. 0.058 0.058 ↓ 0.0 0 58

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

  • 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 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) (never executed)

  • Index Cond: ((stock_id = b1.stock_id) AND (fund_id = b1.fund_id) AND (fund_id = 3))
  • Heap Fetches: 0
147. 0.039 0.090 ↓ 0.0 0 45

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

148. 0.045 0.045 ↓ 0.0 0 45

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
149. 0.006 0.006 ↑ 1.0 1 3

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=3)

  • Index Cond: (id = trade_requests_7.status)
150. 0.045 0.045 ↓ 0.0 0 45

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 time=0.001..0.001 rows=0 loops=45)

  • Index Cond: ((stock_id = a8.stock_id) AND (fund_id = a8.fund_id))
  • Heap Fetches: 3
151. 0.040 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)

152. 0.046 0.046 ↓ 0.0 0 46

Index Scan using active_trades on trade_requests trade_requests_8 (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))
153. 0.006 0.006 ↑ 1.0 1 3

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

  • Index Cond: (id = trade_requests_8.status)
154. 0.371 3.220 ↑ 1.0 1 46

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

155. 0.090 1.058 ↑ 16.0 1 46

Nested Loop (cost=1.71..372.16 rows=16 width=22) (actual time=0.004..0.023 rows=1 loops=46)

156. 0.068 0.736 ↑ 21.0 1 46

Nested Loop (cost=1.14..200.33 rows=21 width=26) (actual time=0.003..0.016 rows=1 loops=46)

  • Join Filter: (sf_1.stock_id = s.id)
157. 0.102 0.552 ↑ 21.0 1 46

Nested Loop (cost=0.85..192.78 rows=21 width=26) (actual time=0.003..0.012 rows=1 loops=46)

158. 0.276 0.276 ↑ 22.0 1 46

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

  • Index Cond: (parent_stock_id = a1.id)
159. 0.174 0.174 ↑ 1.0 1 58

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 time=0.003..0.003 rows=1 loops=58)

  • Index Cond: ((stock_id = sf_1.stock_id) AND (fund_id = 3))
  • Heap Fetches: 49
160. 0.116 0.116 ↑ 1.0 1 58

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=58)

  • Index Cond: (id = sff_1.stock_id)
161. 0.232 0.232 ↑ 1.0 1 58

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

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

SubPlan (for Aggregate)

163. 0.207 0.228 ↑ 1.0 1 57

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=57)

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

Initplan (for Index Scan)

165. 0.002 0.021 ↑ 1.0 1 1

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

166. 0.019 0.019 ↑ 29,862.0 1 1

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

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

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.003..0.003 rows=1 loops=57)

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

Initplan (for Index Scan)

169. 0.001 0.012 ↑ 1.0 1 1

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

170. 0.011 0.011 ↑ 29,862.0 1 1

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

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

Limit (cost=0.57..2.87 rows=1 width=26) (actual time=0.009..0.010 rows=1 loops=58)

172. 0.522 0.522 ↑ 8,414.0 1 58

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 time=0.008..0.009 rows=1 loops=58)

  • 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.058 0.812 ↑ 1.0 1 58

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

174. 0.754 0.754 ↑ 355.0 1 58

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 time=0.013..0.013 rows=1 loops=58)

  • 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.021 0.063 ↓ 0.0 0 7

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

176. 0.042 0.042 ↓ 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..818.22 rows=355 width=26) (actual time=0.006..0.006 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.825 7.590 ↑ 1.0 1 46

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

178.          

Initplan (for Aggregate)

179. 0.015 0.015 ↑ 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.014..0.015 rows=1 loops=1)

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

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 time=0.008..0.125 rows=122 loops=46)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id) AND (date_id >= $51))
181. 0.175 0.184 ↑ 1.0 1 46

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 time=0.003..0.004 rows=1 loops=46)

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

Initplan (for Index Scan)

183. 0.009 0.009 ↑ 1.0 1 1

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

  • Index Cond: (date = (timezone('EST'::text, now()))::date)
184. 0.046 0.322 ↑ 1.0 1 46

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

185. 0.276 0.276 ↑ 8,414.0 1 46

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 time=0.006..0.006 rows=1 loops=46)

  • Index Cond: (stock_id = a2.countryindextickerid)
186. 0.092 0.322 ↑ 1.0 1 46

Limit (cost=0.58..2.87 rows=1 width=26) (actual time=0.006..0.007 rows=1 loops=46)

187. 0.230 0.230 ↑ 8,378.0 1 46

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 time=0.005..0.005 rows=1 loops=46)

  • Index Cond: ((stock_id = a2.countryindextickerid) AND (price_date <= ((CURRENT_DATE - '1 mon'::interval))::date))
188. 0.092 0.276 ↑ 1.0 1 46

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

189. 0.184 0.184 ↑ 8,414.0 1 46

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 time=0.004..0.004 rows=1 loops=46)

  • Index Cond: (stock_id = a2.countryindextickerid)
190. 0.092 0.276 ↑ 1.0 1 46

Limit (cost=0.58..2.87 rows=1 width=26) (actual time=0.005..0.006 rows=1 loops=46)

191. 0.184 0.184 ↑ 8,292.0 1 46

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 time=0.004..0.004 rows=1 loops=46)

  • Index Cond: ((stock_id = a2.countryindextickerid) AND (price_date <= ((CURRENT_DATE - '3 mons'::interval))::date))
192. 0.092 0.276 ↑ 1.0 1 46

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

193. 0.184 0.184 ↑ 8,414.0 1 46

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 time=0.004..0.004 rows=1 loops=46)

  • Index Cond: (stock_id = a2.countryindextickerid)
194. 0.046 0.368 ↑ 1.0 1 46

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

195. 0.322 0.322 ↑ 7,900.0 1 46

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 time=0.007..0.007 rows=1 loops=46)

  • Index Cond: ((stock_id = a2.countryindextickerid) AND (price_date <= ((CURRENT_DATE - '1 year'::interval))::date))
196. 0.184 0.552 ↑ 1.0 1 46

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

197. 0.138 0.368 ↑ 1.0 3 46

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

  • Recheck Cond: ((stock_id = a1.id) AND ((fe_item)::text = 'EPS'::text))
  • Heap Blocks: exact=57
198. 0.230 0.230 ↑ 1.0 3 46

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=46)

  • Index Cond: ((stock_id = a1.id) AND ((fe_item)::text = 'EPS'::text))
199. 0.039 0.273 ↑ 1.0 1 39

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

200. 0.234 0.234 ↑ 9.0 1 39

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 time=0.006..0.006 rows=1 loops=39)

  • Index Cond: ((stock_id = a1.id) AND (price_date >= (CURRENT_DATE - 7)))
201. 0.117 0.312 ↑ 1.0 1 39

Aggregate (cost=15.85..15.86 rows=1 width=8) (actual time=0.007..0.008 rows=1 loops=39)

202. 0.078 0.195 ↑ 1.0 3 39

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 time=0.004..0.005 rows=3 loops=39)

  • Recheck Cond: ((stock_id = a1.id) AND ((fe_item)::text = 'EPS'::text))
  • Heap Blocks: exact=45
203. 0.117 0.117 ↑ 1.0 3 39

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.003..0.003 rows=3 loops=39)

  • Index Cond: ((stock_id = a1.id) AND ((fe_item)::text = 'EPS'::text))
204. 0.936 1.170 ↑ 1.0 1 39

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

  • Filter: (currency = ($65)::text)
  • Rows Removed by Filter: 86
205.          

Initplan (for Seq Scan)

206. 0.039 0.234 ↑ 1.0 1 39

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

207. 0.195 0.195 ↑ 14.0 1 39

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.004..0.005 rows=1 loops=39)

  • Index Cond: (stock_id = a1.id)
208. 0.276 0.276 ↑ 1.0 1 46

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=46)

  • Index Cond: (fsym_id = a11.fsym_id)
Planning time : 28.720 ms
Execution time : 4,704.471 ms