explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Oxq5

Settings
# exclusive inclusive rows x rows loops node
1. 0.024 4,359.240 ↑ 586.3 47 1

Limit (cost=1,418,572.53..63,831,171.30 rows=27,554 width=676) (actual time=4,338.803..4,359.240 rows=47 loops=1)

2. 1.595 4,359.216 ↑ 586.3 47 1

Result (cost=1,418,572.53..63,831,171.30 rows=27,554 width=676) (actual time=4,338.802..4,359.216 rows=47 loops=1)

3. 0.157 4,330.288 ↑ 586.3 47 1

Sort (cost=1,418,523.55..1,418,592.43 rows=27,554 width=371) (actual time=4,330.269..4,330.288 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. 0.273 4,330.131 ↑ 586.3 47 1

Nested Loop Left Join (cost=72,753.26..1,411,780.44 rows=27,554 width=371) (actual time=1,840.199..4,330.131 rows=47 loops=1)

5. 0.107 4,328.965 ↑ 586.3 47 1

Nested Loop Left Join (cost=72,752.97..1,318,062.08 rows=27,554 width=184) (actual time=1,840.166..4,328.965 rows=47 loops=1)

6. 9.621 4,328.576 ↑ 586.3 47 1

Hash Left Join (cost=72,752.54..1,264,860.67 rows=27,554 width=172) (actual time=1,840.151..4,328.576 rows=47 loops=1)

  • Hash Cond: ((SubPlan 51) = a8.id)
7. 399.445 4,203.545 ↑ 586.3 47 1

Hash Left Join (cost=66,030.60..1,244,735.81 rows=27,554 width=156) (actual time=1,724.711..4,203.545 rows=47 loops=1)

  • Hash Cond: ((SubPlan 50) = a7.id)
  • Filter: (((a5.equity_pct__apc > '0'::numeric) AND (a5.equity_pct__apc IS NOT NULL)) OR ((COALESCE((SubPlan 56), CASE WHEN (((SubPlan 57) = ANY ('{Hold,""No Trade"",Cancelled,Completed}'::text[])) OR (CASE WHEN ((a7.request_end IS NULL) AND ((SubPlan 58) <> ALL ('{Hold,""No Trade""}'::text[]))) THEN a7.target_size ELSE NULL::numeric END IS NULL)) THEN (SubPlan 59) ELSE COALESCE(CASE WHEN ((a7.request_end IS NULL) AND ((SubPlan 60) <> ALL ('{Hold,""No Trade""}'::text[]))) THEN a7.target_size ELSE NULL::numeric END, 0.0) END) >= 0.0002) AND (COALESCE((SubPlan 65), CASE WHEN (((SubPlan 66) = ANY ('{Hold,""No Trade"",Cancelled,Completed}'::text[])) OR (CASE WHEN ((a7.request_end IS NULL) AND ((SubPlan 67) <> ALL ('{Hold,""No Trade""}'::text[]))) THEN a7.target_size ELSE NULL::numeric END IS NULL)) THEN (SubPlan 68) ELSE COALESCE(CASE WHEN ((a7.request_end IS NULL) AND ((SubPlan 69) <> 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,625
8. 97.569 2,078.103 ↓ 1.2 57,672 1

Nested Loop Left Join (cost=59,308.65..1,214,674.19 rows=49,797 width=140) (actual time=727.192..2,078.103 rows=57,672 loops=1)

9. 106.439 1,980.534 ↓ 1.2 57,672 1

Nested Loop Left Join (cost=59,308.23..940,634.68 rows=49,797 width=136) (actual time=727.186..1,980.534 rows=57,672 loops=1)

10. 59.817 1,528.063 ↓ 1.2 57,672 1

Hash Left Join (cost=59,306.28..644,050.43 rows=49,797 width=89) (actual time=727.171..1,528.063 rows=57,672 loops=1)

  • Hash Cond: (a1.id = a11.stock_id)
11. 99.746 1,431.145 ↓ 1.2 57,672 1

Nested Loop Left Join (cost=57,435.99..642,049.41 rows=49,797 width=80) (actual time=689.978..1,431.145 rows=57,672 loops=1)

  • Filter: (a12.archive_on IS NULL)
  • Rows Removed by Filter: 7,537
12. 92.466 1,070.563 ↓ 1.0 65,209 1

Hash Join (cost=57,435.42..117,192.11 rows=64,040 width=84) (actual time=689.407..1,070.563 rows=65,209 loops=1)

  • Hash Cond: (a1.id = a2.stock_id)
13. 77.624 547.116 ↓ 1.0 85,240 1

Hash Left Join (cost=26,557.33..84,402.26 rows=85,232 width=24) (actual time=258.349..547.116 rows=85,240 loops=1)

  • Hash Cond: (a1.id = a10.stock_id)
14. 69.730 348.587 ↓ 1.0 85,240 1

Hash Right Join (cost=2,978.81..59,267.01 rows=85,232 width=20) (actual time=137.309..348.587 rows=85,240 loops=1)

  • Hash Cond: (a5.stock_id = a1.id)
15. 223.341 223.341 ↓ 1.0 79,650 1

Seq Scan on stock_fields_fund_specific a5 (cost=0.00..54,983.79 rows=78,246 width=16) (actual time=32.107..223.341 rows=79,650 loops=1)

  • Filter: (fund_id = 3)
  • Rows Removed by Filter: 2,324,226
16. 29.390 55.516 ↓ 1.0 85,240 1

Hash (cost=1,580.41..1,580.41 rows=85,232 width=8) (actual time=55.515..55.516 rows=85,240 loops=1)

  • Buckets: 131,072 Batches: 2 Memory Usage: 2,688kB
17. 26.126 26.126 ↓ 1.0 85,240 1

Seq Scan on stocks a1 (cost=0.00..1,580.41 rows=85,232 width=8) (actual time=0.009..26.126 rows=85,240 loops=1)

  • Filter: ((id IS NOT NULL) AND (id <> 87532))
  • Rows Removed by Filter: 1
18. 29.022 120.905 ↑ 1.0 85,045 1

Hash (cost=22,182.45..22,182.45 rows=85,045 width=8) (actual time=120.905..120.905 rows=85,045 loops=1)

  • Buckets: 131,072 Batches: 2 Memory Usage: 2,519kB
19. 91.883 91.883 ↑ 1.0 85,045 1

Seq Scan on stock_fields_extension2 a10 (cost=0.00..22,182.45 rows=85,045 width=8) (actual time=0.009..91.883 rows=85,045 loops=1)

20. 38.575 430.981 ↓ 1.0 65,210 1

Hash (cost=29,389.58..29,389.58 rows=64,041 width=64) (actual time=430.981..430.981 rows=65,210 loops=1)

  • Buckets: 65,536 Batches: 2 Memory Usage: 3,468kB
21. 392.406 392.406 ↓ 1.0 65,210 1

Seq Scan on stock_fields a2 (cost=0.00..29,389.58 rows=64,041 width=64) (actual time=0.029..392.406 rows=65,210 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
22. 260.836 260.836 ↑ 1.0 1 65,209

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

  • Index Cond: (id = a1.entity_id)
23. 19.564 37.101 ↓ 1.0 62,725 1

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

  • Buckets: 65,536 Batches: 1 Memory Usage: 3,453kB
24. 17.537 17.537 ↓ 1.0 62,725 1

Seq Scan on factset_mappings a11 (cost=0.00..1,086.24 rows=62,724 width=13) (actual time=0.007..17.537 rows=62,725 loops=1)

25. 115.344 346.032 ↑ 1.0 1 57,672

Bitmap Heap Scan on price_history_cache a3 (cost=1.94..5.96 rows=1 width=51) (actual time=0.006..0.006 rows=1 loops=57,672)

  • Recheck Cond: (stock_id = a1.id)
  • Heap Blocks: exact=46,550
26. 230.688 230.688 ↑ 1.0 1 57,672

Bitmap Index Scan on price_history_cache_stock_id_idx1 (cost=0.00..1.94 rows=1 width=0) (actual time=0.004..0.004 rows=1 loops=57,672)

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

Index Scan using private_company_fields_pkey on private_company_fields a4 (cost=0.42..5.50 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=57,672)

  • Index Cond: (id = a2.private_company_id)
28. 51.207 113.133 ↑ 1.0 145,518 1

Hash (cost=4,047.42..4,047.42 rows=145,642 width=20) (actual time=113.133..113.133 rows=145,518 loops=1)

  • Buckets: 65,536 Batches: 4 Memory Usage: 2,254kB
29. 61.926 61.926 ↑ 1.0 145,518 1

Seq Scan on trade_requests a7 (cost=0.00..4,047.42 rows=145,642 width=20) (actual time=0.006..61.926 rows=145,518 loops=1)

30.          

SubPlan (for Hash Left Join)

31. 57.520 288.125 ↑ 1.0 1 57,625

Aggregate (cost=1,016.84..1,016.85 rows=1 width=32) (actual time=0.005..0.005 rows=1 loops=57,625)

32. 57.485 230.500 ↓ 0.0 0 57,625

Nested Loop Left Join (cost=9.72..325.29 rows=14 width=28) (actual time=0.004..0.004 rows=0 loops=57,625)

33. 57.625 172.875 ↓ 0.0 0 57,625

Nested Loop Left Join (cost=9.29..298.26 rows=14 width=20) (actual time=0.003..0.003 rows=0 loops=57,625)

34. 0.000 115.250 ↓ 0.0 0 57,625

Nested Loop (cost=0.71..175.97 rows=14 width=4) (actual time=0.002..0.002 rows=0 loops=57,625)

35. 115.250 115.250 ↓ 0.0 0 57,625

Index Scan using stock_fields_parent_stock_id_idx on stock_fields x4_1 (cost=0.42..59.63 rows=14 width=4) (actual time=0.002..0.002 rows=0 loops=57,625)

  • Index Cond: (parent_stock_id = a1.id)
36. 0.105 0.105 ↑ 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.003..0.003 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 55))
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.140 0.140 ↑ 1.0 1 35

Index Scan using stock_fields_fund_specific_stock_id_fund_id_key on stock_fields_fund_specific x3_1 (cost=0.43..1.93 rows=1 width=12) (actual time=0.004..0.004 rows=1 loops=35)

  • Index Cond: ((stock_id = x1_1.id) AND (fund_id = 3))
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.597 115.250 ↓ 0.0 0 57,625

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

52. 57.625 57.625 ↓ 0.0 0 57,625

Index Scan using active_trades 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,625)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
53. 0.028 0.028 ↑ 1.0 1 4

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

  • Index Cond: (id = trade_requests_15.status)
54. 0.000 57.625 ↓ 0.0 0 57,625

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

55. 57.625 57.625 ↓ 0.0 0 57,625

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

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

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

  • Index Cond: (id = trade_requests_16.status)
57. 115.242 345.726 ↑ 1.0 1 57,621

Aggregate (cost=8.45..8.46 rows=1 width=32) (actual time=0.005..0.006 rows=1 loops=57,621)

58. 230.484 230.484 ↑ 1.0 1 57,621

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..8.45 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=57,621)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
  • Heap Fetches: 55,150
59. 0.012 0.028 ↑ 1.0 1 4

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual time=0.006..0.007 rows=1 loops=4)

60. 0.008 0.008 ↑ 1.0 1 4

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

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

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

  • Index Cond: (id = trade_requests_17.status)
62. 115.019 287.810 ↑ 1.0 1 57,562

Aggregate (cost=1,016.84..1,016.85 rows=1 width=32) (actual time=0.004..0.005 rows=1 loops=57,562)

63. 0.000 172.686 ↓ 0.0 0 57,562

Nested Loop Left Join (cost=9.72..325.29 rows=14 width=28) (actual time=0.003..0.003 rows=0 loops=57,562)

64. 57.527 172.686 ↓ 0.0 0 57,562

Nested Loop Left Join (cost=9.29..298.26 rows=14 width=20) (actual time=0.003..0.003 rows=0 loops=57,562)

65. 0.000 115.124 ↓ 0.0 0 57,562

Nested Loop (cost=0.71..175.97 rows=14 width=4) (actual time=0.002..0.002 rows=0 loops=57,562)

66. 115.124 115.124 ↓ 0.0 0 57,562

Index Scan using stock_fields_parent_stock_id_idx on stock_fields x4_2 (cost=0.42..59.63 rows=14 width=4) (actual time=0.002..0.002 rows=0 loops=57,562)

  • 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.035 ↓ 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.001..0.001 rows=0 loops=35)

  • Index Cond: (id = (SubPlan 64))
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 Scan using stock_fields_fund_specific_stock_id_fund_id_key on stock_fields_fund_specific x3_2 (cost=0.43..1.93 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=35)

  • Index Cond: ((stock_id = x1_2.id) AND (fund_id = 3))
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.562 115.124 ↓ 0.0 0 57,562

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

83. 57.562 57.562 ↓ 0.0 0 57,562

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
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. 0.000 57.562 ↓ 0.0 0 57,562

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

86. 57.562 57.562 ↓ 0.0 0 57,562

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
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. 57.562 230.248 ↑ 1.0 1 57,562

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

89. 172.686 172.686 ↑ 1.0 1 57,562

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..8.45 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=57,562)

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

Nested Loop (cost=0.42..16.46 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..8.16 rows=1 width=4) (never executed)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
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.683 115.366 ↓ 0.0 0 57,683

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

94. 57.683 57.683 ↓ 0.0 0 57,683

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
95. 58.935 115.356 ↑ 1.0 145,518 1

Hash (cost=4,047.42..4,047.42 rows=145,642 width=20) (actual time=115.356..115.356 rows=145,518 loops=1)

  • Buckets: 65,536 Batches: 4 Memory Usage: 2,291kB
96. 56.421 56.421 ↑ 1.0 145,518 1

Seq Scan on trade_requests a8 (cost=0.00..4,047.42 rows=145,642 width=20) (actual time=0.007..56.421 rows=145,518 loops=1)

97.          

SubPlan (for Hash Left Join)

98. 0.054 0.054 ↓ 0.0 0 54

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

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

Index Scan using stock_fields_fund_specific_stock_id_fund_id_key on stock_fields_fund_specific a6 (cost=0.43..1.93 rows=1 width=16) (actual time=0.006..0.006 rows=1 loops=47)

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

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

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

SubPlan (for Nested Loop Left Join)

102. 0.094 0.564 ↑ 1.0 1 47

Limit (cost=0.57..2.83 rows=1 width=26) (actual time=0.011..0.012 rows=1 loops=47)

103. 0.470 0.470 ↑ 8,533.0 1 47

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,244.44 rows=8,533 width=26) (actual time=0.010..0.010 rows=1 loops=47)

  • Index Cond: ((stock_id = a1.id) AND (price_date <= '2020-09-02'::date))
104.          

SubPlan (for Result)

105. 0.047 0.517 ↑ 1.0 1 47

Aggregate (cost=178.03..178.04 rows=1 width=32) (actual time=0.011..0.011 rows=1 loops=47)

106. 0.234 0.470 ↓ 0.0 0 47

Index Scan using stock_fields_parent_stock_id_idx on stock_fields sf (cost=0.42..177.96 rows=7 width=12) (actual time=0.010..0.010 rows=0 loops=47)

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

SubPlan (for Index Scan)

108. 0.236 0.236 ↑ 1.0 1 59

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.004..0.004 rows=1 loops=59)

  • Index Cond: ((stock_id = sf.stock_id) AND (fund_id = 3))
109. 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)
110. 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)
111. 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.006..0.006 rows=1 loops=7)

  • Index Cond: (id = a4.id)
112. 0.164 1.034 ↑ 1.0 1 47

Aggregate (cost=1,016.84..1,016.85 rows=1 width=32) (actual time=0.022..0.022 rows=1 loops=47)

113. 0.105 0.752 ↑ 14.0 1 47

Nested Loop Left Join (cost=9.72..325.29 rows=14 width=28) (actual time=0.004..0.016 rows=1 loops=47)

114. 0.188 0.470 ↑ 14.0 1 47

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

115. 0.070 0.282 ↑ 14.0 1 47

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

116. 0.094 0.094 ↑ 14.0 1 47

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

  • Index Cond: (parent_stock_id = a1.id)
117. 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)
118. 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))
119.          

SubPlan (for Index Scan)

120. 0.059 0.059 ↓ 0.0 0 59

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

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

Index Scan using stock_fields_fund_specific_stock_id_fund_id_key on stock_fields_fund_specific x3 (cost=0.43..1.93 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=59)

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

SubPlan (for Aggregate)

123. 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)

124. 0.059 0.059 ↓ 0.0 0 59

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

  • 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 (cost=0.29..8.30 rows=1 width=15) (never executed)

  • Index Cond: (id = trade_requests.status)
126. 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)

127. 0.059 0.059 ↓ 0.0 0 59

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

  • 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_1 (cost=0.29..8.30 rows=1 width=15) (never executed)

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

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

130. 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))
131. 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)
132. 0.025 0.138 ↓ 0.0 0 46

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

133. 0.092 0.092 ↓ 0.0 0 46

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
134. 0.021 0.021 ↑ 1.0 1 7

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

  • Index Cond: (id = trade_requests_4.status)
135. 0.032 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 Scan using active_trades 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))
137. 0.014 0.014 ↑ 1.0 1 7

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

  • Index Cond: (id = trade_requests_5.status)
138. 0.117 0.351 ↑ 1.0 1 39

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

139. 0.234 0.234 ↑ 1.0 1 39

Index Only Scan using stock_fields_fund_specific_stock_fund_equity_idx on stock_fields_fund_specific (cost=0.43..8.45 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=39)

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
  • Heap Fetches: 39
140. 0.007 0.035 ↑ 1.0 1 7

Nested Loop (cost=0.42..16.46 rows=1 width=11) (actual time=0.004..0.005 rows=1 loops=7)

141. 0.014 0.014 ↑ 1.0 1 7

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
142. 0.014 0.014 ↑ 1.0 1 7

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

  • Index Cond: (id = trade_requests_6.status)
143. 0.058 0.058 ↓ 1.4 94 1

Index Only Scan using stock_fields_parent_stock_id_idx on stock_fields stock_fields_2 (cost=0.42..48.81 rows=68 width=4) (actual time=0.008..0.058 rows=94 loops=1)

  • Index Cond: (parent_stock_id IS NOT NULL)
  • Heap Fetches: 40
144. 0.002 0.129 ↑ 1.0 1 1

Aggregate (cost=134.14..134.15 rows=1 width=32) (actual time=0.128..0.129 rows=1 loops=1)

145. 0.001 0.127 ↓ 0.0 0 1

Nested Loop Left Join (cost=0.98..134.13 rows=1 width=16) (actual time=0.126..0.127 rows=0 loops=1)

146. 0.025 0.126 ↓ 0.0 0 1

Nested Loop (cost=0.55..125.91 rows=1 width=16) (actual time=0.125..0.126 rows=0 loops=1)

147. 0.042 0.042 ↓ 4.2 59 1

Index Scan using stock_fields_parent_stock_id_idx on stock_fields b2 (cost=0.42..59.63 rows=14 width=4) (actual time=0.006..0.042 rows=59 loops=1)

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

Index Scan using active_trades on trade_requests b1 (cost=0.14..4.73 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[])))
149. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: ((b1.stock_id = stock_id) AND (b1.fund_id = fund_id) AND (fund_id = 3))
150. 0.032 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)

151. 0.046 0.046 ↓ 0.0 0 46

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
152. 0.014 0.014 ↑ 1.0 1 7

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

  • Index Cond: (id = trade_requests_7.status)
153. 0.046 0.046 ↓ 0.0 0 46

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=8) (actual time=0.001..0.001 rows=0 loops=46)

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

155. 0.047 0.047 ↓ 0.0 0 47

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

  • Index Cond: ((stock_id = a1.id) AND (fund_id = 3))
156. 0.014 0.014 ↑ 1.0 1 7

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

  • Index Cond: (id = trade_requests_8.status)
157. 0.410 3.384 ↑ 1.0 1 47

Aggregate (cost=522.06..522.07 rows=1 width=32) (actual time=0.071..0.072 rows=1 loops=47)

158. 0.105 1.034 ↑ 10.0 1 47

Nested Loop (cost=1.71..289.03 rows=10 width=24) (actual time=0.004..0.022 rows=1 loops=47)

159. 0.070 0.752 ↑ 13.0 1 47

Nested Loop (cost=1.14..182.62 rows=13 width=28) (actual time=0.003..0.016 rows=1 loops=47)

  • Join Filter: (sf_1.stock_id = s.id)
160. 0.105 0.564 ↑ 13.0 1 47

Nested Loop (cost=0.85..177.93 rows=13 width=28) (actual time=0.003..0.012 rows=1 loops=47)

161. 0.282 0.282 ↑ 14.0 1 47

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

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

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

  • Index Cond: ((stock_id = sf_1.stock_id) AND (fund_id = 3))
  • Heap Fetches: 59
163. 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)
164. 0.177 0.177 ↑ 1.0 1 59

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

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

SubPlan (for Aggregate)

166. 0.215 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 = $43))
167.          

Initplan (for Index Scan)

168. 0.002 0.017 ↑ 1.0 1 1

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

169. 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.70 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
170. 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.003..0.003 rows=1 loops=58)

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

Initplan (for Index Scan)

172. 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)

173. 0.012 0.012 ↑ 29,866.0 1 1

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

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

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

175. 0.531 0.531 ↑ 8,546.0 1 59

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw (cost=0.57..19,273.64 rows=8,546 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))
176. 0.118 0.885 ↑ 1.0 1 59

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

177. 0.767 0.767 ↑ 345.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..782.51 rows=345 width=26) (actual time=0.013..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)))
178. 0.014 0.063 ↓ 0.0 0 7

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

179. 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..782.51 rows=345 width=26) (actual time=0.006..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)))
180. 1.916 7.990 ↑ 1.0 1 47

Aggregate (cost=172.94..172.95 rows=1 width=32) (actual time=0.170..0.170 rows=1 loops=47)

181.          

Initplan (for Aggregate)

182. 0.011 0.011 ↑ 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.011 rows=1 loops=1)

  • Index Cond: (date = make_date((date_part('year'::text, (CURRENT_DATE)::timestamp without time zone))::integer, 1, 1))
183. 6.063 6.063 ↓ 2.6 121 47

Index Scan using positions_fund_id_stock_id_date_id_key on positions positions_2 (cost=0.43..164.50 rows=46 width=7) (actual time=0.007..0.129 rows=121 loops=47)

  • Index Cond: ((fund_id = 3) AND (stock_id = a1.id) AND (date_id >= $51))
184. 7.990 8.319 ↑ 1.0 1 47

Result (cost=25.59..25.61 rows=1 width=32) (actual time=0.177..0.177 rows=1 loops=47)

185.          

Initplan (for Result)

186. 0.000 0.188 ↑ 1.0 1 47

Index Scan using positions_fund_id_stock_id_date_id_key on positions positions_3 (cost=0.80..8.83 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 = $54))
187.          

Initplan (for Index Scan)

188. 0.003 7.799 ↑ 1.0 1 1

Limit (cost=0.29..0.37 rows=1 width=4) (actual time=7.798..7.799 rows=1 loops=1)

189. 7.796 7.796 ↑ 29,866.0 1 1

Index Scan Backward using dates_id_idx on dates dates_3 (cost=0.29..2,506.79 rows=29,866 width=4) (actual time=7.796..7.796 rows=1 loops=1)

  • Filter: (is_coatue_trading_day AND (date <= (timezone('America/New_York'::text, now()))::date))
  • Rows Removed by Filter: 18,735
190. 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.003..0.003 rows=1 loops=47)

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

Initplan (for Index Scan)

192. 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.005..0.005 rows=1 loops=1)

  • Index Cond: (date = '2020-09-01'::date)
193. 0.136 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=7) (actual time=0.003..0.003 rows=1 loops=47)

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

Initplan (for Index Scan)

195. 0.005 0.005 ↑ 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.005 rows=1 loops=1)

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

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

197. 0.235 0.235 ↑ 8,550.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,261.25 rows=8,550 width=26) (actual time=0.005..0.005 rows=1 loops=47)

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

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

199. 0.188 0.188 ↑ 8,510.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,192.79 rows=8,510 width=26) (actual time=0.003..0.004 rows=1 loops=47)

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

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

201. 0.188 0.188 ↑ 8,550.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..19,261.25 rows=8,550 width=26) (actual time=0.004..0.004 rows=1 loops=47)

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

Limit (cost=0.58..2.83 rows=1 width=26) (actual time=0.010..0.010 rows=1 loops=47)

203. 0.423 0.423 ↑ 8,427.0 1 47

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_7 (cost=0.58..19,001.94 rows=8,427 width=26) (actual time=0.008..0.009 rows=1 loops=47)

  • Index Cond: ((stock_id = a2.countryindextickerid) AND (price_date <= ((CURRENT_DATE - '3 mons'::interval))::date))
204. 0.094 0.235 ↑ 1.0 1 47

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

205. 0.141 0.141 ↑ 8,550.0 1 47

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_8 (cost=0.57..19,261.25 rows=8,550 width=26) (actual time=0.003..0.003 rows=1 loops=47)

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

Limit (cost=0.58..2.83 rows=1 width=26) (actual time=0.007..0.007 rows=1 loops=47)

207. 0.282 0.282 ↑ 8,061.0 1 47

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_9 (cost=0.58..18,179.07 rows=8,061 width=26) (actual time=0.005..0.006 rows=1 loops=47)

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

Aggregate (cost=15.85..15.86 rows=1 width=8) (actual time=0.011..0.012 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. 0.080 0.320 ↑ 1.0 1 40

Limit (cost=0.57..3.30 rows=1 width=26) (actual time=0.007..0.008 rows=1 loops=40)

212. 0.240 0.240 ↑ 12.0 1 40

Index Scan Backward using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_10 (cost=0.57..33.30 rows=12 width=26) (actual time=0.006..0.006 rows=1 loops=40)

  • Index Cond: ((stock_id = a1.id) AND (price_date >= (CURRENT_DATE - 7)))
213. 0.080 0.280 ↑ 1.0 1 40

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

214. 0.080 0.200 ↑ 1.0 3 40

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.85 rows=3 width=8) (actual time=0.004..0.005 rows=3 loops=40)

  • Recheck Cond: ((stock_id = a1.id) AND ((fe_item)::text = 'EPS'::text))
  • Heap Blocks: exact=45
215. 0.120 0.120 ↑ 1.0 3 40

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

  • Index Cond: ((stock_id = a1.id) AND ((fe_item)::text = 'EPS'::text))
216. 1.000 1.240 ↑ 1.0 1 40

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

  • Filter: (currency = ($71)::text)
  • Rows Removed by Filter: 86
217.          

Initplan (for Seq Scan)

218. 0.040 0.240 ↑ 1.0 1 40

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

219. 0.200 0.200 ↑ 14.0 1 40

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

  • Index Cond: (stock_id = a1.id)
220. 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 = a11.fsym_id)
Planning time : 28.624 ms
Execution time : 4,360.753 ms