explain.depesz.com

A tool for finding a real cause for slow queries.

Result: wmC

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 0.001 148,822.439 ↑ 1.0 30 1

Limit (cost=406,142.72..406,142.79 rows=30 width=440) (actual time=148,822.435..148,822.439 rows=30 loops=1)

2. 403.477 148,822.438 ↑ 2.0 30 1

Sort (cost=406,142.72..406,142.86 rows=59 width=440) (actual time=148,822.435..148,822.438 rows=30 loops=1)

  • Sort Key: br.created_at
  • Sort Method: top-N heapsort Memory: 40kB
3. 275.605 148,418.961 ↓ 3,062.5 180,688 1

Hash Left Join (cost=397,268.03..406,140.98 rows=59 width=440) (actual time=135,968.359..148,418.961 rows=180,688 loops=1)

  • Hash Cond: (results.result_type_id = result_types.result_type_id)
4. 58.550 148,143.351 ↓ 3,062.5 180,688 1

Nested Loop Left Join (cost=397,266.94..406,138.05 rows=59 width=410) (actual time=135,968.326..148,143.351 rows=180,688 loops=1)

5. 181.705 147,362.049 ↓ 3,062.5 180,688 1

Nested Loop Left Join (cost=397,266.94..406,119.85 rows=59 width=404) (actual time=135,968.308..147,362.049 rows=180,688 loops=1)

  • Join Filter: ((max(cl.created_at)) = cl.created_at)
6. 100.578 146,638.280 ↓ 3,062.5 180,688 1

Hash Left Join (cost=397,266.94..406,004.13 rows=59 width=400) (actual time=135,968.290..146,638.280 rows=180,688 loops=1)

  • Hash Cond: (c.customer_id = cl.customer_id)
7. 10,139.254 146,436.235 ↓ 3,062.5 180,688 1

Hash Right Join (cost=382,757.74..391,482.73 rows=59 width=392) (actual time=135,866.806..146,436.235 rows=180,688 loops=1)

  • Hash Cond: (s.selection_id = sel.selection_id)
8. 1,019.855 3,302.260 ↓ 3.1 1,153,698 1

HashAggregate (cost=221,571.69..225,245.29 rows=367,360 width=12) (actual time=2,872.051..3,302.260 rows=1,153,698 loops=1)

9. 335.993 2,282.405 ↓ 3.2 1,163,023 1

Hash Left Join (cost=173,739.49..219,734.89 rows=367,360 width=12) (actual time=1,152.297..2,282.405 rows=1,163,023 loops=1)

  • Hash Cond: ((s.placement_id = s.placement_id) AND (s.selection_id = s.selection_id))
  • Filter: (((s.placement_id IS NULL) AND (r.placement_id IS NULL)) OR ((s.placement_id IS NOT NULL) AND (r.placement_id IS NULL) AND (r.created_at < (min(r.created_at)))) OR (s.placement_id = r.placement_id))
10. 475.995 1,618.252 ↓ 1.1 1,179,190 1

Merge Join (cost=139,240.12..176,966.30 rows=1,102,561 width=36) (actual time=824.114..1,618.252 rows=1,179,190 loops=1)

  • Merge Cond: (r.outcome_id = s.outcome_id)
  • Join Filter: (s.handicap = r.handicap)
11. 134.954 134.954 ↑ 1.0 346,262 1

Index Scan using results_outcome_id_idx on results r (cost=0.00..12,126.62 rows=346,291 width=28) (actual time=0.009..134.954 rows=346,262 loops=1)

12. 829.461 1,007.303 ↓ 1.1 1,301,751 1

Sort (cost=139,239.50..142,138.58 rows=1,159,631 width=24) (actual time=824.090..1,007.303 rows=1,301,751 loops=1)

  • Sort Key: s.outcome_id
  • Sort Method: quicksort Memory: 139745kB
13. 177.842 177.842 ↑ 1.0 1,159,586 1

Seq Scan on selections s (cost=0.00..22,434.31 rows=1,159,631 width=24) (actual time=0.005..177.842 rows=1,159,586 loops=1)

14. 0.249 328.160 ↓ 1,308.0 1,308 1

Hash (cost=34,499.35..34,499.35 rows=1 width=24) (actual time=328.160..328.160 rows=1,308 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 72kB
15. 1.314 327.911 ↓ 1,308.0 1,308 1

HashAggregate (cost=34,499.33..34,499.34 rows=1 width=24) (actual time=327.623..327.911 rows=1,308 loops=1)

16. 109.912 326.597 ↓ 1,744.0 1,744 1

Merge Join (cost=211.63..34,499.32 rows=1 width=24) (actual time=1.341..326.597 rows=1,744 loops=1)

  • Merge Cond: (s.placement_id = r.placement_id)
  • Join Filter: ((s.outcome_id = r.outcome_id) AND (s.handicap = r.handicap))
17. 215.574 215.574 ↑ 1.0 1,155,420 1

Index Scan using selections_placement_id_idx on selections s (cost=0.00..31,414.75 rows=1,159,631 width=24) (actual time=0.019..215.574 rows=1,155,420 loops=1)

18. 1.111 1.111 ↑ 97.2 3,561 1

Index Scan using results_placement_id_idx on results r (cost=0.00..12,124.62 rows=346,291 width=24) (actual time=0.011..1.111 rows=3,561 loops=1)

19. 274.162 132,994.721 ↓ 3,062.5 180,688 1

Hash (cost=161,185.32..161,185.32 rows=59 width=388) (actual time=132,994.721..132,994.721 rows=180,688 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 67405kB
20. 104.878 132,720.559 ↓ 3,062.5 180,688 1

Hash Left Join (cost=134,515.38..161,185.32 rows=59 width=388) (actual time=119,644.414..132,720.559 rows=180,688 loops=1)

  • Hash Cond: (br.bet_client_id = bc.bet_client_id)
21. 137.292 132,615.669 ↓ 3,062.5 180,688 1

Nested Loop Left Join (cost=134,514.29..161,183.42 rows=59 width=356) (actual time=119,644.382..132,615.669 rows=180,688 loops=1)

22. 288.621 132,117.001 ↓ 3,062.5 180,688 1

Hash Left Join (cost=134,514.29..161,048.89 rows=59 width=357) (actual time=119,644.374..132,117.001 rows=180,688 loops=1)

  • Hash Cond: (e.event_id = kw_league.event_id)
23. 281.655 131,693.983 ↓ 3,062.5 180,688 1

Hash Left Join (cost=127,535.24..153,924.88 rows=59 width=333) (actual time=119,509.950..131,693.983 rows=180,688 loops=1)

  • Hash Cond: (e.event_id = kw_sport.event_id)
24. 102.761 131,285.056 ↓ 3,062.5 180,688 1

Nested Loop (cost=120,556.18..146,800.87 rows=59 width=309) (actual time=119,382.657..131,285.056 rows=180,688 loops=1)

25. 45.365 130,820.919 ↓ 3,062.5 180,688 1

Nested Loop (cost=120,556.18..146,784.11 rows=59 width=274) (actual time=119,382.649..130,820.919 rows=180,688 loops=1)

26. 114.388 130,233.490 ↓ 3,062.5 180,688 1

Nested Loop (cost=120,556.18..146,766.06 rows=59 width=248) (actual time=119,382.636..130,233.490 rows=180,688 loops=1)

27. 610.070 129,577.038 ↓ 3,062.5 180,688 1

Hash Join (cost=120,556.18..146,627.37 rows=59 width=236) (actual time=119,382.622..129,577.038 rows=180,688 loops=1)

  • Hash Cond: (s.placement_id = s.placement_id)
28. 93.635 126,182.919 ↓ 4,439.9 261,957 1

Nested Loop (cost=91,051.94..117,122.32 rows=59 width=260) (actual time=116,598.563..126,182.919 rows=261,957 loops=1)

29. 510.579 125,734.632 ↓ 5,910.9 88,663 1

Hash Join (cost=91,051.94..117,085.80 rows=15 width=227) (actual time=116,598.553..125,734.632 rows=88,663 loops=1)

  • Hash Cond: (er.target_id = erc.currency_id)
30. 1,200.189 125,224.030 ↓ 5,432.4 4,622,954 1

Nested Loop (cost=91,050.23..117,080.75 rows=851 width=229) (actual time=116,598.498..125,224.030 rows=4,622,954 loops=1)

31. 2,461.023 122,693.896 ↓ 3,057.3 88,663 1

Hash Join (cost=91,050.22..116,490.17 rows=29 width=221) (actual time=116,598.444..122,693.896 rows=88,663 loops=1)

  • Hash Cond: (s.placement_id = s.placement_id)
32. 2,866.586 16,689.330 ↓ 1,036.8 89,162 1

Hash Right Join (cost=61,005.17..86,444.51 rows=86 width=213) (actual time=13,054.881..16,689.330 rows=89,162 loops=1)

  • Hash Cond: (s.placement_id = p.placement_id)
33. 0.000 1,530.638 ↓ 5.7 615,797 1

Hash Join (cost=31,236.14..56,271.42 rows=107,712 width=32) (actual time=762.554..1,530.638 rows=615,797 loops=1)

  • Hash Cond: (s.operation_id = so.id)
  • Filter: (hashed SubPlan 1)
  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
  • Filter: (cname = 'settle'::text)
34. 1,242.632 1,242.632 ↓ 1.9 615,830 1

Seq Scan on settlements s (cost=31,235.09..53,981.49 rows=323,136 width=34) (actual time=762.516..1,242.632 rows=615,830 loops=1)

35.          

SubPlan (forHash Join)

36. 566.469 566.469 ↓ 1.1 615,830 1

HashAggregate (cost=24,362.08..29,860.49 rows=549,841 width=16) (actual time=379.239..566.469 rows=615,830 loops=1)

37. 80.265 80.265 ↑ 1.0 642,001 1

Seq Scan on settlements (cost=0.00..21,130.72 rows=646,272 width=16) (actual time=0.007..80.265 rows=642,001 loops=1)

38. 0.012 0.012 ↑ 1.0 1 1

Hash (cost=1.04..1.04 rows=1 width=2) (actual time=0.012..0.012 rows=1 loops=1)

39. 0.011 0.011 ↑ 1.0 1 1

Seq Scan on settlement_operations so (cost=0.00..1.04 rows=1 width=2) (actual time=0.010..0.011 rows=1 loops=1)

40. 0.000 12,292.106 ↓ 1,036.8 89,162 1

Hash (cost=29,767.95..29,767.95 rows=86 width=189) (actual time=12,292.106..12,292.106 rows=89,162 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 16950kB
  • Merge Cond: (cu.currency_id = p.currency_id)
  • Sort Key: p.currency_id
  • Sort Method: quicksort Memory: 26756kB
  • Hash Cond: (p.bet_type_id = bt.bet_type_id)
  • Hash Cond: (c.country_id = country.country_id)
  • Join Filter: (c.operator_id = op.operator_id)
  • Hash Cond: (s.outcome_id = o.outcome_id)
  • Buckets: 1024 Batches: 1 Memory Usage: 9730kB
  • Filter: (cname = 'country'::text)
  • Index Cond: ((cname = 'england'::text) AND (keyword_type_id = kt.keyword_type_id))
  • Index Cond: (keyword_id = k.keyword_id)
  • Index Cond: (event_id = ek.event_id)
  • Index Cond: (event_id = e.event_id)
  • Index Cond: (market_id = m.market_id)
  • Index Cond: (placement_id = s.placement_id)
  • Index Cond: (bet_request_id = p.bet_request_id)
  • Index Cond: (customer_id = br.customer_id)
  • Buckets: 1024 Batches: 1 Memory Usage: 7kB
  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
41. 12,242.384 12,242.384 ↓ 1,036.8 89,162 1

Merge Join (cost=29,763.41..29,767.95 rows=86 width=189) (actual time=12,190.701..12,242.384 rows=89,162 loops=1)

42. 0.040 0.040 ↑ 1.3 44 1

Index Scan using currencies_pkey on currencies cu (cost=0.00..4.09 rows=56 width=6) (actual time=0.014..0.040 rows=44 loops=1)

43. 12,202.341 12,202.341 ↓ 1,036.8 89,162 1

Sort (cost=29,763.41..29,763.63 rows=86 width=183) (actual time=12,190.678..12,202.341 rows=89,162 loops=1)

44. 12,110.579 12,110.579 ↓ 1,036.8 89,162 1

Hash Join (cost=29,507.94..29,760.65 rows=86 width=183) (actual time=11,013.023..12,110.579 rows=89,162 loops=1)

45. 12,073.410 12,073.410 ↓ 1,036.8 89,162 1

Hash Join (cost=29,506.36..29,757.88 rows=86 width=151) (actual time=11,013.002..12,073.410 rows=89,162 loops=1)

46. 12,035.265 12,035.265 ↓ 1,036.8 89,162 1

Nested Loop (cost=29,501.44..29,751.78 rows=86 width=148) (actual time=11,012.938..12,035.265 rows=89,162 loops=1)

47. 0.003 0.003 ↑ 1.0 1 1

Seq Scan on operators op (cost=0.00..1.01 rows=1 width=34) (actual time=0.002..0.003 rows=1 loops=1)

48. 12,010.496 12,010.496 ↓ 1,036.8 89,162 1

Nested Loop (cost=29,501.44..29,749.70 rows=86 width=116) (actual time=11,012.930..12,010.496 rows=89,162 loops=1)

49. 11,739.638 11,739.638 ↓ 1,036.8 89,162 1

Nested Loop (cost=29,501.44..29,725.39 rows=86 width=96) (actual time=11,012.921..11,739.638 rows=89,162 loops=1)

50. 11,410.173 11,410.173 ↓ 1,036.8 89,162 1

Nested Loop (cost=29,501.44..29,698.75 rows=86 width=54) (actual time=11,012.902..11,410.173 rows=89,162 loops=1)

51. 11,046.952 11,046.952 ↓ 1,036.8 89,162 1

HashAggregate (cost=29,501.44..29,502.30 rows=86 width=8) (actual time=11,012.868..11,046.952 rows=89,162 loops=1)

52. 10,930.405 10,930.405 ↓ 1,702.4 146,409 1

Hash Join (cost=2,717.44..29,501.23 rows=86 width=8) (actual time=347.094..10,930.405 rows=146,409 loops=1)

53. 141.504 141.504 ↑ 1.0 1,159,586 1

Seq Scan on selections s (cost=0.00..22,434.31 rows=1,159,631 width=12) (actual time=0.004..141.504 rows=1,159,586 loops=1)

54. 345.671 345.671 ↓ 1,456.5 276,741 1

Hash (cost=2,715.07..2,715.07 rows=190 width=4) (actual time=345.671..345.671 rows=276,741 loops=1)

55. 291.004 291.004 ↓ 1,456.5 276,741 1

Nested Loop (cost=0.00..2,715.07 rows=190 width=4) (actual time=0.070..291.004 rows=276,741 loops=1)

56. 55.230 55.230 ↓ 1,173.9 64,563 1

Nested Loop (cost=0.00..2,673.26 rows=55 width=4) (actual time=0.062..55.230 rows=64,563 loops=1)

57. 18.564 18.564 ↓ 703.2 3,516 1

Nested Loop (cost=0.00..2,668.38 rows=5 width=8) (actual time=0.054..18.564 rows=3,516 loops=1)

58. 10.147 10.147 ↓ 703.2 3,516 1

Nested Loop (cost=0.00..2,666.95 rows=5 width=4) (actual time=0.045..10.147 rows=3,516 loops=1)

59. 0.035 0.035 ↑ 1.0 1 1

Nested Loop (cost=0.00..3.49 rows=1 width=8) (actual time=0.029..0.035 rows=1 loops=1)

60. 0.011 0.011 ↑ 1.0 1 1

Seq Scan on keyword_types kt (cost=0.00..1.20 rows=1 width=4) (actual time=0.006..0.011 rows=1 loops=1)

61. 0.020 0.020 ↑ 1.0 1 1

Index Scan using keywords_cname_keyword_type_id_idx on keywords k (cost=0.00..2.27 rows=1 width=12) (actual time=0.019..0.020 rows=1 loops=1)

62. 9.508 9.508 ↓ 74.8 3,516 1

Index Scan using events_keywords_event_id_keyword_id_idx on events_keywords ek (cost=0.00..2,662.87 rows=47 width=8) (actual time=0.015..9.508 rows=3,516 loops=1)

63. 7.032 7.032 ↑ 1.0 1 3,516

Index Scan using events_pkey on events e (cost=0.00..0.27 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=3,516)

64. 24.612 24.612 ↑ 1.2 18 3,516

Index Scan using markets_event_id_idx on markets m (cost=0.00..0.70 rows=22 width=8) (actual time=0.003..0.007 rows=18 loops=3,516)

65. 193.689 193.689 ↑ 3.2 4 64,563

Index Scan using outcomes_market_id_idx on outcomes o (cost=0.00..0.60 rows=13 width=8) (actual time=0.002..0.003 rows=4 loops=64,563)

66. 356.648 356.648 ↑ 1.0 1 89,162

Index Scan using placements_pkey on placements p (cost=0.00..2.26 rows=1 width=46) (actual time=0.003..0.004 rows=1 loops=89,162)

67. 267.486 267.486 ↑ 1.0 1 89,162

Index Scan using bet_requests_pkey on bet_requests br (cost=0.00..0.30 rows=1 width=50) (actual time=0.003..0.003 rows=1 loops=89,162)

68. 267.486 267.486 ↑ 1.0 1 89,162

Index Scan using customers_pkey on customers c (cost=0.00..0.27 rows=1 width=36) (actual time=0.002..0.003 rows=1 loops=89,162)

69. 0.058 0.058 ↓ 1.0 177 1

Hash (cost=2.74..2.74 rows=174 width=5) (actual time=0.058..0.058 rows=177 loops=1)

70. 0.029 0.029 ↓ 1.0 177 1

Seq Scan on countries country (cost=0.00..2.74 rows=174 width=5) (actual time=0.007..0.029 rows=177 loops=1)

71. 0.014 0.014 ↑ 1.0 26 1

Hash (cost=1.26..1.26 rows=26 width=34) (actual time=0.014..0.014 rows=26 loops=1)

72. 0.008 0.008 ↑ 1.0 26 1

Seq Scan on bet_types bt (cost=0.00..1.26 rows=26 width=34) (actual time=0.004..0.008 rows=26 loops=1)

73. 59.818 103,543.543 ↓ 12,874.0 373,346 1

Hash (cost=30,044.69..30,044.69 rows=29 width=8) (actual time=103,543.543..103,543.543 rows=373,346 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14584kB
74. 0.000 103,483.725 ↓ 12,874.0 373,346 1

HashAggregate (cost=30,044.11..30,044.40 rows=29 width=8) (actual time=103,383.001..103,483.725 rows=373,346 loops=1)

  • Hash Cond: (s.outcome_id = o.outcome_id)
  • Buckets: 1024 Batches: 1 Memory Usage: 55566kB
  • Join Filter: (k.keyword_type_id = kt.keyword_type_id)
  • Index Cond: (cname = 'soccer'::text)
  • Filter: (cname = 'sport'::text)
  • Index Cond: (keyword_id = k.keyword_id)
  • Index Cond: (event_id = ek.event_id)
  • Index Cond: (event_id = e.event_id)
  • Index Cond: (market_id = m.market_id)
75. 103,004.995 103,004.995 ↓ 24,048.6 697,408 1

Hash Join (cost=3,260.82..30,044.03 rows=29 width=8) (actual time=1,942.910..103,004.995 rows=697,408 loops=1)

76. 196.809 196.809 ↑ 1.0 1,159,586 1

Seq Scan on selections s (cost=0.00..22,434.31 rows=1,159,631 width=12) (actual time=0.005..196.809 rows=1,159,586 loops=1)

77. 1,942.771 1,942.771 ↓ 25,087.7 1,580,527 1

Hash (cost=3,260.03..3,260.03 rows=63 width=4) (actual time=1,942.771..1,942.771 rows=1,580,527 loops=1)

78. 1,651.972 1,651.972 ↓ 25,087.7 1,580,527 1

Nested Loop (cost=0.00..3,260.03 rows=63 width=4) (actual time=0.079..1,651.972 rows=1,580,527 loops=1)

79. 281.364 281.364 ↓ 20,841.6 375,149 1

Nested Loop (cost=0.00..3,246.35 rows=18 width=4) (actual time=0.070..281.364 rows=375,149 loops=1)

80. 65.134 65.134 ↓ 10,064.5 20,129 1

Nested Loop (cost=0.00..3,244.40 rows=2 width=8) (actual time=0.061..65.134 rows=20,129 loops=1)

81. 20.038 20.038 ↓ 10,064.5 20,129 1

Nested Loop (cost=0.00..3,243.82 rows=2 width=4) (actual time=0.053..20.038 rows=20,129 loops=1)

82. 0.049 0.049 ↑ 1.0 1 1

Nested Loop (cost=0.00..3.48 rows=1 width=8) (actual time=0.034..0.049 rows=1 loops=1)

83. 0.024 0.024 ↓ 2.0 2 1

Index Scan using keywords_cname_keyword_type_id_idx on keywords k (cost=0.00..2.27 rows=1 width=12) (actual time=0.021..0.024 rows=2 loops=1)

84. 0.010 0.010 ↑ 1.0 1 2

Seq Scan on keyword_types kt (cost=0.00..1.20 rows=1 width=4) (actual time=0.002..0.005 rows=1 loops=2)

85. 16.309 16.309 ↓ 428.3 20,129 1

Index Scan using events_keywords_event_id_keyword_id_idx on events_keywords ek (cost=0.00..3,239.75 rows=47 width=8) (actual time=0.016..16.309 rows=20,129 loops=1)

86. 40.258 40.258 ↑ 1.0 1 20,129

Index Scan using events_pkey on events e (cost=0.00..0.27 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=20,129)

87. 161.032 161.032 ↑ 1.2 19 20,129

Index Scan using markets_event_id_idx on markets m (cost=0.00..0.70 rows=22 width=8) (actual time=0.002..0.008 rows=19 loops=20,129)

88. 1,125.447 1,125.447 ↑ 3.2 4 375,149

Index Scan using outcomes_market_id_idx on outcomes o (cost=0.00..0.60 rows=13 width=8) (actual time=0.002..0.003 rows=4 loops=375,149)

89. 1,329.945 1,329.945 ↓ 1.8 52 88,663

Index Scan using exchange_rates_date_source_id_target_id_idx on exchange_rates er (cost=0.01..19.64 rows=29 width=16) (actual time=0.005..0.015 rows=52 loops=88,663)

  • Index Cond: ((date = COALESCE((timezone('UTC'::text, s.created_at))::date, (timezone('UTC'::text, br.created_at))::date)) AND (source_id = cu.currency_id))
90. 0.003 0.023 ↑ 1.0 1 1

Hash (cost=1.70..1.70 rows=1 width=2) (actual time=0.023..0.023 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
91. 0.020 0.020 ↑ 1.0 1 1

Seq Scan on currencies erc (cost=0.00..1.70 rows=1 width=2) (actual time=0.020..0.020 rows=1 loops=1)

  • Filter: (code = 'EUR'::bpchar)
92. 354.652 354.652 ↑ 1.3 3 88,663

Index Scan using selections_placement_id_idx on selections sel (cost=0.00..2.38 rows=4 width=33) (actual time=0.003..0.004 rows=3 loops=88,663)

  • Index Cond: (placement_id = s.placement_id)
93. 10.338 2,784.049 ↓ 839.2 72,169 1

Hash (cost=29,503.16..29,503.16 rows=86 width=8) (actual time=2,784.049..2,784.049 rows=72,169 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 2820kB
94. 60.832 2,773.711 ↓ 839.2 72,169 1

HashAggregate (cost=29,501.44..29,502.30 rows=86 width=8) (actual time=2,758.099..2,773.711 rows=72,169 loops=1)

95. 2,431.198 2,712.879 ↓ 1,201.0 103,290 1

Hash Join (cost=2,717.44..29,501.23 rows=86 width=8) (actual time=169.622..2,712.879 rows=103,290 loops=1)

  • Hash Cond: (s.outcome_id = o.outcome_id)
96. 115.624 115.624 ↑ 1.0 1,159,586 1

Seq Scan on selections s (cost=0.00..22,434.31 rows=1,159,631 width=12) (actual time=0.009..115.624 rows=1,159,586 loops=1)

97. 23.662 166.057 ↓ 657.7 124,968 1

Hash (cost=2,715.07..2,715.07 rows=190 width=4) (actual time=166.057..166.057 rows=124,968 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 4394kB
98. 20.663 142.395 ↓ 657.7 124,968 1

Nested Loop (cost=0.00..2,715.07 rows=190 width=4) (actual time=0.068..142.395 rows=124,968 loops=1)

99. 0.000 31.765 ↓ 545.3 29,989 1

Nested Loop (cost=0.00..2,673.26 rows=55 width=4) (actual time=0.061..31.765 rows=29,989 loops=1)

  • Filter: (cname = 'league'::text)
  • Index Cond: ((cname = 'premier-league'::text) AND (keyword_type_id = kt.keyword_type_id))
  • Index Cond: (keyword_id = k.keyword_id)
  • Index Cond: (event_id = ek.event_id)
  • Index Cond: (event_id = e.event_id)
100. 13.285 13.285 ↓ 329.4 1,647 1

Nested Loop (cost=0.00..2,668.38 rows=5 width=8) (actual time=0.054..13.285 rows=1,647 loops=1)

101. 9.047 9.047 ↓ 329.4 1,647 1

Nested Loop (cost=0.00..2,666.95 rows=5 width=4) (actual time=0.048..9.047 rows=1,647 loops=1)

102. 0.038 0.038 ↑ 1.0 1 1

Nested Loop (cost=0.00..3.49 rows=1 width=8) (actual time=0.032..0.038 rows=1 loops=1)

103. 0.012 0.012 ↑ 1.0 1 1

Seq Scan on keyword_types kt (cost=0.00..1.20 rows=1 width=4) (actual time=0.007..0.012 rows=1 loops=1)

104. 0.024 0.024 ↑ 1.0 1 1

Index Scan using keywords_cname_keyword_type_id_idx on keywords k (cost=0.00..2.27 rows=1 width=12) (actual time=0.023..0.024 rows=1 loops=1)

105. 8.711 8.711 ↓ 35.0 1,647 1

Index Scan using events_keywords_event_id_keyword_id_idx on events_keywords ek (cost=0.00..2,662.87 rows=47 width=8) (actual time=0.015..8.711 rows=1,647 loops=1)

106. 3.294 3.294 ↑ 1.0 1 1,647

Index Scan using events_pkey on events e (cost=0.00..0.27 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1,647)

107. 13.176 13.176 ↑ 1.2 18 1,647

Index Scan using markets_event_id_idx on markets m (cost=0.00..0.70 rows=22 width=8) (actual time=0.003..0.008 rows=18 loops=1,647)

108. 89.967 89.967 ↑ 3.2 4 29,989

Index Scan using outcomes_market_id_idx on outcomes o (cost=0.00..0.60 rows=13 width=8) (actual time=0.002..0.003 rows=4 loops=29,989)

  • Index Cond: (market_id = m.market_id)
109. 542.064 542.064 ↑ 1.0 1 180,688

Index Scan using outcomes_outcome_id_idx on outcomes o (cost=0.00..2.34 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=180,688)

  • Index Cond: (outcome_id = sel.outcome_id)
110. 542.064 542.064 ↑ 1.0 1 180,688

Index Scan using markets_pkey on markets m (cost=0.00..0.29 rows=1 width=30) (actual time=0.002..0.003 rows=1 loops=180,688)

  • Index Cond: (market_id = o.market_id)
111. 361.376 361.376 ↑ 1.0 1 180,688

Index Scan using events_pkey on events e (cost=0.00..0.27 rows=1 width=39) (actual time=0.002..0.002 rows=1 loops=180,688)

  • Index Cond: (event_id = m.event_id)
112. 13.354 127.272 ↓ 2.8 54,674 1

Hash (cost=6,733.88..6,733.88 rows=19,614 width=28) (actual time=127.272..127.272 rows=54,674 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 3190kB
113. 7.394 113.918 ↓ 2.8 54,674 1

Subquery Scan on kw_sport (cost=6,341.60..6,733.88 rows=19,614 width=28) (actual time=93.174..113.918 rows=54,674 loops=1)

114. 34.680 106.524 ↓ 2.8 54,674 1

HashAggregate (cost=6,341.60..6,537.74 rows=19,614 width=28) (actual time=93.173..106.524 rows=54,674 loops=1)

115. 42.362 71.844 ↓ 2.8 54,674 1

Hash Join (cost=294.04..6,194.50 rows=19,614 width=28) (actual time=0.684..71.844 rows=54,674 loops=1)

  • Hash Cond: (ek.keyword_id = k.keyword_id)
116. 28.815 28.815 ↑ 1.0 313,790 1

Seq Scan on events_keywords ek (cost=0.00..4,527.32 rows=313,832 width=8) (actual time=0.007..28.815 rows=313,790 loops=1)

117. 0.013 0.667 ↑ 12.5 62 1

Hash (cost=284.39..284.39 rows=772 width=24) (actual time=0.667..0.667 rows=62 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 3kB
118. 0.011 0.654 ↑ 12.5 62 1

Nested Loop (cost=0.00..284.39 rows=772 width=24) (actual time=0.040..0.654 rows=62 loops=1)

119. 0.006 0.006 ↑ 1.0 1 1

Seq Scan on keyword_types kt (cost=0.00..1.20 rows=1 width=4) (actual time=0.004..0.006 rows=1 loops=1)

  • Filter: (cname = 'sport'::text)
120. 0.637 0.637 ↑ 12.5 62 1

Index Scan using keywords_cname_keyword_type_id_idx on keywords k (cost=0.00..273.54 rows=772 width=28) (actual time=0.034..0.637 rows=62 loops=1)

  • Index Cond: (keyword_type_id = kt.keyword_type_id)
121. 13.653 134.397 ↓ 2.8 54,542 1

Hash (cost=6,733.88..6,733.88 rows=19,614 width=28) (actual time=134.397..134.397 rows=54,542 loops=1)

122. 7.420 120.744 ↓ 2.8 54,542 1

Buckets: 2048 Batches: 1 Memory Usage: 3352kB -> Subquery Scan on kw_league (cost=6,341.60..6,733.88 rows=19,614 width=28) (actual time=99.971..120.744 rows=54,542 loops=1)

123. 35.747 113.324 ↓ 2.8 54,542 1

HashAggregate (cost=6,341.60..6,537.74 rows=19,614 width=28) (actual time=99.969..113.324 rows=54,542 loops=1)

124. 47.234 77.577 ↓ 2.8 54,542 1

Hash Join (cost=294.04..6,194.50 rows=19,614 width=28) (actual time=1.601..77.577 rows=54,542 loops=1)

  • Hash Cond: (ek.keyword_id = k.keyword_id)
125. 28.764 28.764 ↑ 1.0 313,790 1

Seq Scan on events_keywords ek (cost=0.00..4,527.32 rows=313,832 width=8) (actual time=0.011..28.764 rows=313,790 loops=1)

126. 0.282 1.579 ↓ 1.4 1,086 1

Hash (cost=284.39..284.39 rows=772 width=24) (actual time=1.579..1.579 rows=1,086 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 63kB
127. 0.198 1.297 ↓ 1.4 1,086 1

Nested Loop (cost=0.00..284.39 rows=772 width=24) (actual time=0.028..1.297 rows=1,086 loops=1)

128. 0.007 0.007 ↑ 1.0 1 1

Seq Scan on keyword_types kt (cost=0.00..1.20 rows=1 width=4) (actual time=0.005..0.007 rows=1 loops=1)

  • Filter: (cname = 'league'::text)
129. 1.092 1.092 ↓ 1.4 1,086 1

Index Scan using keywords_cname_keyword_type_id_idx on keywords k (cost=0.00..273.54 rows=772 width=28) (actual time=0.018..1.092 rows=1,086 loops=1)

  • Index Cond: (keyword_type_id = kt.keyword_type_id)
130. 361.376 361.376 ↑ 1.0 1 180,688

Index Scan using sessions_pkey on sessions ses (cost=0.00..2.27 rows=1 width=15) (actual time=0.002..0.002 rows=1 loops=180,688)

  • Index Cond: (session_id = br.session_tracker_id)
131. 0.003 0.012 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=34) (actual time=0.012..0.012 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
132. 0.009 0.009 ↑ 1.0 4 1

Seq Scan on bet_clients bc (cost=0.00..1.04 rows=4 width=34) (actual time=0.007..0.009 rows=4 loops=1)

133. 0.217 101.467 ↑ 1.5 1,121 1

Hash (cost=14,488.82..14,488.82 rows=1,630 width=24) (actual time=101.467..101.467 rows=1,121 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 62kB
134. 21.089 101.250 ↑ 1.5 1,121 1

HashAggregate (cost=14,456.22..14,472.52 rows=1,630 width=24) (actual time=101.044..101.250 rows=1,121 loops=1)

135. 17.476 80.161 ↓ 6.5 83,838 1

Nested Loop (cost=0.00..14,391.41 rows=12,963 width=24) (actual time=0.057..80.161 rows=83,838 loops=1)

  • Join Filter: (br.created_at >= cl.created_at)
136. 2.116 2.116 ↓ 1.0 1,637 1

Seq Scan on customer_limits cl (cost=0.00..497.98 rows=1,629 width=24) (actual time=0.024..2.116 rows=1,637 loops=1)

  • Filter: (max_bet IS NOT NULL)
137. 60.569 60.569 ↑ 1.7 57 1,637

Index Scan using bet_requests_customer_id_idx on bet_requests br (cost=0.00..7.10 rows=95 width=24) (actual time=0.006..0.037 rows=57 loops=1,637)

  • Index Cond: (customer_id = cl.customer_id)
138. 542.064 542.064 ↑ 1.0 1 180,688

Index Scan using customer_limits_customer_id_idx on customer_limits cl (cost=0.00..1.95 rows=1 width=36) (actual time=0.003..0.003 rows=1 loops=180,688)

  • Index Cond: (customer_id = c.customer_id)
139. 722.752 722.752 ↑ 1.0 1 180,688

Index Scan using results_pkey on results (cost=0.00..0.30 rows=1 width=14) (actual time=0.003..0.004 rows=1 loops=180,688)

  • Index Cond: (result_id = (max(r.result_id)))
140. 0.001 0.005 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=34) (actual time=0.005..0.005 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
141. 0.004 0.004 ↑ 1.0 4 1

Seq Scan on result_types (cost=0.00..1.04 rows=4 width=34) (actual time=0.002..0.004 rows=4 loops=1)