explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1Wch

Settings
# exclusive inclusive rows x rows loops node
1. 0.024 4,230.468 ↑ 1,304.3 47 1

Limit (cost=1,520,160.56..194,375,232.18 rows=61,302 width=670) (actual time=4,207.374..4,230.468 rows=47 loops=1)

2. 1.802 4,230.444 ↑ 1,304.3 47 1

Result (cost=1,520,160.56..194,375,232.18 rows=61,302 width=670) (actual time=4,207.373..4,230.444 rows=47 loops=1)

3. 0.150 4,206.560 ↑ 1,304.3 47 1

Sort (cost=1,520,134.40..1,520,287.66 rows=61,302 width=364) (actual time=4,206.541..4,206.560 rows=47 loops=1)

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

Hash Left Join (cost=83,858.18..1,504,990.78 rows=61,302 width=364) (actual time=661.530..4,206.410 rows=47 loops=1)

  • Hash Cond: ((SubPlan 49) = a8.id)
5. 3.645 4,091.939 ↑ 1,304.3 47 1

Hash Left Join (cost=77,136.66..1,248,966.13 rows=61,302 width=162) (actual time=557.711..4,091.939 rows=47 loops=1)

  • Hash Cond: (a1.id = a9.stock_id)
6. 285.357 3,937.265 ↑ 1,304.3 47 1

Hash Left Join (cost=69,911.58..1,238,428.13 rows=61,302 width=154) (actual time=406.540..3,937.265 rows=47 loops=1)

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

Nested Loop Left Join (cost=63,333.06..1,177,776.82 rows=110,788 width=146) (actual time=266.253..2,803.494 rows=57,678 loops=1)

8. 89.179 1,375.302 ↓ 1.2 57,678 1

Nested Loop Left Join (cost=63,331.47..899,318.11 rows=49,721 width=99) (actual time=266.238..1,375.302 rows=57,678 loops=1)

9. 56.568 1,286.123 ↓ 1.2 57,678 1

Hash Left Join (cost=63,331.04..625,379.73 rows=49,721 width=95) (actual time=266.228..1,286.123 rows=57,678 loops=1)

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

Hash Left Join (cost=61,460.75..623,378.92 rows=49,721 width=86) (actual time=228.755..1,192.153 rows=57,678 loops=1)

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

Hash Left Join (cost=32,258.35..592,395.98 rows=49,721 width=75) (actual time=130.771..1,020.542 rows=57,678 loops=1)

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

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

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

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

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

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

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

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

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

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

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

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

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

Hash (cost=27,877.89..27,877.89 rows=80,566 width=15) (actual time=76.628..76.628 rows=79,652 loops=1)

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

Bitmap Heap Scan on stock_fields_fund_specific a5 (cost=1,508.82..27,877.89 rows=80,566 width=15) (actual time=4.692..51.884 rows=79,652 loops=1)

  • Recheck Cond: (fund_id = 3)
  • Heap Blocks: exact=1,985
20. 4.460 4.460 ↑ 1.0 79,895 1

Bitmap Index Scan on stock_fields_fund_specific_fund_stock_idx (cost=0.00..1,488.67 rows=80,566 width=0) (actual time=4.460..4.460 rows=79,895 loops=1)

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

Hash (cost=27,829.39..27,829.39 rows=78,961 width=15) (actual time=97.844..97.844 rows=79,638 loops=1)

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

Bitmap Heap Scan on stock_fields_fund_specific a6 (cost=1,480.38..27,829.39 rows=78,961 width=15) (actual time=6.712..70.261 rows=79,638 loops=1)

  • Recheck Cond: (fund_id = 4)
  • Heap Blocks: exact=13,264
23. 4.913 4.913 ↓ 1.0 79,704 1

Bitmap Index Scan on stock_fields_fund_specific_fund_stock_idx (cost=0.00..1,460.64 rows=78,961 width=0) (actual time=4.913..4.913 rows=79,704 loops=1)

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

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

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

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

26. 0.000 0.000 ↓ 0.0 0 57,678

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

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

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

  • Recheck Cond: (stock_id = a1.id)
  • Heap Blocks: exact=1,410,485
28. 288.390 288.390 ↓ 25.0 25 57,678

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

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

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

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

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

31.          

SubPlan (for Hash Left Join)

32. 57.561 230.524 ↑ 1.0 1 57,631

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

33. 0.000 172.893 ↓ 0.0 0 57,631

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

34. 57.631 172.893 ↓ 0.0 0 57,631

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

35. 0.000 115.262 ↓ 0.0 0 57,631

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

36. 115.262 115.262 ↓ 0.0 0 57,631

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

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

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

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

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

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

SubPlan (for Index Scan)

40. 0.035 0.035 ↓ 0.0 0 35

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

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

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

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

SubPlan (for Aggregate)

43. 0.000 0.035 ↓ 0.0 0 35

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

44. 0.035 0.035 ↓ 0.0 0 35

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

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

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

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

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

47. 0.035 0.035 ↓ 0.0 0 35

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

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

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

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

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

50. 0.000 0.000 ↓ 0.0 0

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

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

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

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

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

53. 57.631 57.631 ↓ 0.0 0 57,631

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

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

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

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

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

56. 0.000 0.000 ↓ 0.0 0

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

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

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

58. 57.631 57.631 ↓ 0.0 0 57,631

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

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

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

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

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

61. 172.875 172.875 ↑ 1.0 1 57,625

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

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

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

63. 0.000 0.000 ↓ 0.0 0

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

64. 0.000 0.000 ↓ 0.0 0

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

65. 0.000 0.000 ↓ 0.0 0

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

66. 0.000 0.000 ↓ 0.0 0

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

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

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

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

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

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

SubPlan (for Index Scan)

70. 0.000 0.000 ↓ 0.0 0

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

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

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

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

SubPlan (for Aggregate)

73. 0.000 0.000 ↓ 0.0 0

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

74. 0.000 0.000 ↓ 0.0 0

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

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

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

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

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

77. 0.000 0.000 ↓ 0.0 0

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

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

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

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

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

80. 0.000 0.000 ↓ 0.0 0

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

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

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

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

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

83. 0.000 0.000 ↓ 0.0 0

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

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

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

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

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

86. 0.000 0.000 ↓ 0.0 0

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

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

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

88. 0.000 0.000 ↓ 0.0 0

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

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

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

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

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

91. 0.000 0.000 ↓ 0.0 0

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

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

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

93. 57.688 57.688 ↓ 0.0 0 57,688

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

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

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

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

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

96. 52.778 103.717 ↑ 1.0 145,533 1

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

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

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

98.          

SubPlan (for Hash Left Join)

99. 0.094 0.423 ↑ 1.0 1 47

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

100. 0.329 0.329 ↑ 8.0 1 47

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

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

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

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

SubPlan (for Result)

103. 0.047 0.470 ↑ 1.0 1 47

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

104. 0.187 0.423 ↓ 0.0 0 47

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

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

SubPlan (for Index Scan)

106. 0.236 0.236 ↑ 1.0 1 59

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

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

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

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

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

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

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

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

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

111. 0.058 0.705 ↑ 21.0 1 47

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

112. 0.141 0.470 ↑ 21.0 1 47

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

113. 0.070 0.329 ↑ 21.0 1 47

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

114. 0.141 0.141 ↑ 21.0 1 47

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

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

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

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

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

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

SubPlan (for Index Scan)

118. 0.059 0.059 ↓ 0.0 0 59

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

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

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

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

SubPlan (for Aggregate)

121. 0.000 0.059 ↓ 0.0 0 59

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

122. 0.059 0.059 ↓ 0.0 0 59

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

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

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

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

125. 0.059 0.059 ↓ 0.0 0 59

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

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

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

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

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

128. 0.000 0.000 ↓ 0.0 0

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

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

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

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

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

131. 0.046 0.046 ↓ 0.0 0 46

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

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

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

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

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

134. 0.000 0.000 ↓ 0.0 0

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

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

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

136. 0.046 0.046 ↓ 0.0 0 46

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

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

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

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

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

139. 0.252 0.252 ↑ 1.0 1 42

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

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

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

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

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

142. 0.001 0.127 ↓ 0.0 0 1

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

143. 0.025 0.126 ↓ 0.0 0 1

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

144. 0.042 0.042 ↓ 2.8 59 1

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

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

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

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

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

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

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

148. 0.046 0.046 ↓ 0.0 0 46

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

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

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

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

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

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

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

152. 0.047 0.047 ↓ 0.0 0 47

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

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

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

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

Aggregate (cost=795.68..795.69 rows=1 width=32) (actual time=0.079..0.079 rows=1 loops=47)

155. 0.093 1.081 ↑ 16.0 1 47

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

156. 0.070 0.752 ↑ 20.0 1 47

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

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

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

158. 0.282 0.282 ↑ 21.0 1 47

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

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

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

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

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

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

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

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

SubPlan (for Aggregate)

163. 0.274 0.290 ↑ 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.005 rows=1 loops=58)

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

Initplan (for Index Scan)

165. 0.002 0.016 ↑ 1.0 1 1

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

166. 0.014 0.014 ↑ 29,866.0 1 1

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

  • Index Cond: (date <= (timezone('America/New_York'::text, now()))::date)
  • Filter: is_coatue_trading_day
167. 0.220 0.232 ↑ 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.004 rows=1 loops=58)

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

Initplan (for Index Scan)

169. 0.002 0.012 ↑ 1.0 1 1

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

170. 0.010 0.010 ↑ 29,866.0 1 1

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

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

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

172. 0.708 0.708 ↑ 8,400.0 1 59

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

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

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

174. 0.767 0.767 ↑ 347.0 1 59

Index Scan using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_1 (cost=0.58..805.88 rows=347 width=26) (actual time=0.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)))
175. 0.021 0.084 ↓ 0.0 0 7

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

176. 0.063 0.063 ↓ 0.0 0 7

Index Scan using price_history_new_stock_id_price_date_all_idx on price_history_raw price_history_raw_2 (cost=0.58..805.88 rows=347 width=26) (actual time=0.009..0.009 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.963 8.037 ↑ 1.0 1 47

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

178.          

Initplan (for Aggregate)

179. 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))
180. 6.063 6.063 ↓ 2.7 122 47

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

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

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

182.          

Initplan (for Result)

183. 0.208 0.235 ↑ 1.0 1 47

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

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

Initplan (for Index Scan)

185. 0.002 0.027 ↑ 1.0 1 1

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

186. 0.008 0.025 ↑ 6.0 1 1

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

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

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

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

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

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

Initplan (for Index Scan)

190. 0.005 0.005 ↑ 1.0 1 1

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

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

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

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

Initplan (for Index Scan)

193. 0.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)
194. 0.235 0.470 ↑ 1.0 1 47

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

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

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

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

197. 0.188 0.188 ↑ 8,361.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,311.20 rows=8,361 width=26) (actual time=0.004..0.004 rows=1 loops=47)

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

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

  • Recheck Cond: (stock_id = a2.countryindextickerid)
  • Heap Blocks: exact=1,771
199. 0.235 0.235 ↓ 38.0 38 47

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

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

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

  • Recheck Cond: (stock_id = a2.countryindextickerid)
  • Heap Blocks: exact=1,771
201. 0.188 0.188 ↓ 38.0 38 47

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

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

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

  • Recheck Cond: (stock_id = a2.countryindextickerid)
  • Heap Blocks: exact=1,771
203. 0.188 0.188 ↓ 38.0 38 47

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

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

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

  • Recheck Cond: (stock_id = a2.countryindextickerid)
  • Heap Blocks: exact=1,771
205. 0.188 0.188 ↓ 38.0 38 47

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

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

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

207. 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
208. 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))
209. 1.175 1.457 ↑ 1.0 1 47

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

  • Filter: (currency = ($68)::text)
  • Rows Removed by Filter: 86
210.          

Initplan (for Seq Scan)

211. 0.047 0.282 ↑ 1.0 1 47

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

212. 0.235 0.235 ↑ 14.0 1 47

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

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

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

  • Index Cond: (fsym_id = a10.fsym_id)
Planning time : 28.404 ms
Execution time : 4,231.949 ms