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 148822.439 ↑ 1.0 30 1

Limit (cost=406142.72..406142.79 rows=30 width=440) (actual time=148822.435..148822.439 rows=30 loops=1)

2. 403.477 148822.438 ↑ 2.0 30 1

Sort (cost=406142.72..406142.86 rows=59 width=440) (actual time=148822.435..148822.438 rows=30 loops=1)

  • Sort Key: br.created_at
  • Sort Method: top-N heapsort Memory: 40kB
3. 275.605 148418.961 ↓ 3062.5 180688 1

Hash Left Join (cost=397268.03..406140.98 rows=59 width=440) (actual time=135968.359..148418.961 rows=180688 loops=1)

  • Hash Cond: (results.result_type_id = result_types.result_type_id)
4. 58.550 148143.351 ↓ 3062.5 180688 1

Nested Loop Left Join (cost=397266.94..406138.05 rows=59 width=410) (actual time=135968.326..148143.351 rows=180688 loops=1)

5. 181.705 147362.049 ↓ 3062.5 180688 1

Nested Loop Left Join (cost=397266.94..406119.85 rows=59 width=404) (actual time=135968.308..147362.049 rows=180688 loops=1)

  • Join Filter: ((max(cl.created_at)) = cl.created_at)
6. 100.578 146638.280 ↓ 3062.5 180688 1

Hash Left Join (cost=397266.94..406004.13 rows=59 width=400) (actual time=135968.290..146638.280 rows=180688 loops=1)

  • Hash Cond: (c.customer_id = cl.customer_id)
7. 10139.254 146436.235 ↓ 3062.5 180688 1

Hash Right Join (cost=382757.74..391482.73 rows=59 width=392) (actual time=135866.806..146436.235 rows=180688 loops=1)

  • Hash Cond: (s.selection_id = sel.selection_id)
8. 1019.855 3302.260 ↓ 3.1 1153698 1

HashAggregate (cost=221571.69..225245.29 rows=367360 width=12) (actual time=2872.051..3302.260 rows=1153698 loops=1)

9. 335.993 2282.405 ↓ 3.2 1163023 1

Hash Left Join (cost=173739.49..219734.89 rows=367360 width=12) (actual time=1152.297..2282.405 rows=1163023 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 1618.252 ↓ 1.1 1179190 1

Merge Join (cost=139240.12..176966.30 rows=1102561 width=36) (actual time=824.114..1618.252 rows=1179190 loops=1)

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

Index Scan using results_outcome_id_idx on results r (cost=0.00..12126.62 rows=346291 width=28) (actual time=0.009..134.954 rows=346262 loops=1)

12. 829.461 1007.303 ↓ 1.1 1301751 1

Sort (cost=139239.50..142138.58 rows=1159631 width=24) (actual time=824.090..1007.303 rows=1301751 loops=1)

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

Seq Scan on selections s (cost=0.00..22434.31 rows=1159631 width=24) (actual time=0.005..177.842 rows=1159586 loops=1)

14. 0.249 328.160 ↓ 1308.0 1308 1

Hash (cost=34499.35..34499.35 rows=1 width=24) (actual time=328.160..328.160 rows=1308 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 72kB
15. 1.314 327.911 ↓ 1308.0 1308 1

HashAggregate (cost=34499.33..34499.34 rows=1 width=24) (actual time=327.623..327.911 rows=1308 loops=1)

16. 109.912 326.597 ↓ 1744.0 1744 1

Merge Join (cost=211.63..34499.32 rows=1 width=24) (actual time=1.341..326.597 rows=1744 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 1155420 1

Index Scan using selections_placement_id_idx on selections s (cost=0.00..31414.75 rows=1159631 width=24) (actual time=0.019..215.574 rows=1155420 loops=1)

18. 1.111 1.111 ↑ 97.2 3561 1

Index Scan using results_placement_id_idx on results r (cost=0.00..12124.62 rows=346291 width=24) (actual time=0.011..1.111 rows=3561 loops=1)

19. 274.162 132994.721 ↓ 3062.5 180688 1

Hash (cost=161185.32..161185.32 rows=59 width=388) (actual time=132994.721..132994.721 rows=180688 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 67405kB
20. 104.878 132720.559 ↓ 3062.5 180688 1

Hash Left Join (cost=134515.38..161185.32 rows=59 width=388) (actual time=119644.414..132720.559 rows=180688 loops=1)

  • Hash Cond: (br.bet_client_id = bc.bet_client_id)
21. 137.292 132615.669 ↓ 3062.5 180688 1

Nested Loop Left Join (cost=134514.29..161183.42 rows=59 width=356) (actual time=119644.382..132615.669 rows=180688 loops=1)

22. 288.621 132117.001 ↓ 3062.5 180688 1

Hash Left Join (cost=134514.29..161048.89 rows=59 width=357) (actual time=119644.374..132117.001 rows=180688 loops=1)

  • Hash Cond: (e.event_id = kw_league.event_id)
23. 281.655 131693.983 ↓ 3062.5 180688 1

Hash Left Join (cost=127535.24..153924.88 rows=59 width=333) (actual time=119509.950..131693.983 rows=180688 loops=1)

  • Hash Cond: (e.event_id = kw_sport.event_id)
24. 102.761 131285.056 ↓ 3062.5 180688 1

Nested Loop (cost=120556.18..146800.87 rows=59 width=309) (actual time=119382.657..131285.056 rows=180688 loops=1)

25. 45.365 130820.919 ↓ 3062.5 180688 1

Nested Loop (cost=120556.18..146784.11 rows=59 width=274) (actual time=119382.649..130820.919 rows=180688 loops=1)

26. 114.388 130233.490 ↓ 3062.5 180688 1

Nested Loop (cost=120556.18..146766.06 rows=59 width=248) (actual time=119382.636..130233.490 rows=180688 loops=1)

27. 610.070 129577.038 ↓ 3062.5 180688 1

Hash Join (cost=120556.18..146627.37 rows=59 width=236) (actual time=119382.622..129577.038 rows=180688 loops=1)

  • Hash Cond: (s.placement_id = s.placement_id)
28. 93.635 126182.919 ↓ 4439.9 261957 1

Nested Loop (cost=91051.94..117122.32 rows=59 width=260) (actual time=116598.563..126182.919 rows=261957 loops=1)

29. 510.579 125734.632 ↓ 5910.9 88663 1

Hash Join (cost=91051.94..117085.80 rows=15 width=227) (actual time=116598.553..125734.632 rows=88663 loops=1)

  • Hash Cond: (er.target_id = erc.currency_id)
30. 1200.189 125224.030 ↓ 5432.4 4622954 1

Nested Loop (cost=91050.23..117080.75 rows=851 width=229) (actual time=116598.498..125224.030 rows=4622954 loops=1)

31. 2461.023 122693.896 ↓ 3057.3 88663 1

Hash Join (cost=91050.22..116490.17 rows=29 width=221) (actual time=116598.444..122693.896 rows=88663 loops=1)

  • Hash Cond: (s.placement_id = s.placement_id)
32. 2866.586 16689.330 ↓ 1036.8 89162 1

Hash Right Join (cost=61005.17..86444.51 rows=86 width=213) (actual time=13054.881..16689.330 rows=89162 loops=1)

  • Hash Cond: (s.placement_id = p.placement_id)
33. 0.000 1530.638 ↓ 5.7 615797 1

Hash Join (cost=31236.14..56271.42 rows=107712 width=32) (actual time=762.554..1530.638 rows=615797 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. 1242.632 1242.632 ↓ 1.9 615830 1

Seq Scan on settlements s (cost=31235.09..53981.49 rows=323136 width=34) (actual time=762.516..1242.632 rows=615830 loops=1)

35.          

SubPlan (forHash Join)

36. 566.469 566.469 ↓ 1.1 615830 1

HashAggregate (cost=24362.08..29860.49 rows=549841 width=16) (actual time=379.239..566.469 rows=615830 loops=1)

37. 80.265 80.265 ↑ 1.0 642001 1

Seq Scan on settlements (cost=0.00..21130.72 rows=646272 width=16) (actual time=0.007..80.265 rows=642001 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 12292.106 ↓ 1036.8 89162 1

Hash (cost=29767.95..29767.95 rows=86 width=189) (actual time=12292.106..12292.106 rows=89162 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. 12242.384 12242.384 ↓ 1036.8 89162 1

Merge Join (cost=29763.41..29767.95 rows=86 width=189) (actual time=12190.701..12242.384 rows=89162 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. 12202.341 12202.341 ↓ 1036.8 89162 1

Sort (cost=29763.41..29763.63 rows=86 width=183) (actual time=12190.678..12202.341 rows=89162 loops=1)

44. 12110.579 12110.579 ↓ 1036.8 89162 1

Hash Join (cost=29507.94..29760.65 rows=86 width=183) (actual time=11013.023..12110.579 rows=89162 loops=1)

45. 12073.410 12073.410 ↓ 1036.8 89162 1

Hash Join (cost=29506.36..29757.88 rows=86 width=151) (actual time=11013.002..12073.410 rows=89162 loops=1)

46. 12035.265 12035.265 ↓ 1036.8 89162 1

Nested Loop (cost=29501.44..29751.78 rows=86 width=148) (actual time=11012.938..12035.265 rows=89162 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. 12010.496 12010.496 ↓ 1036.8 89162 1

Nested Loop (cost=29501.44..29749.70 rows=86 width=116) (actual time=11012.930..12010.496 rows=89162 loops=1)

49. 11739.638 11739.638 ↓ 1036.8 89162 1

Nested Loop (cost=29501.44..29725.39 rows=86 width=96) (actual time=11012.921..11739.638 rows=89162 loops=1)

50. 11410.173 11410.173 ↓ 1036.8 89162 1

Nested Loop (cost=29501.44..29698.75 rows=86 width=54) (actual time=11012.902..11410.173 rows=89162 loops=1)

51. 11046.952 11046.952 ↓ 1036.8 89162 1

HashAggregate (cost=29501.44..29502.30 rows=86 width=8) (actual time=11012.868..11046.952 rows=89162 loops=1)

52. 10930.405 10930.405 ↓ 1702.4 146409 1

Hash Join (cost=2717.44..29501.23 rows=86 width=8) (actual time=347.094..10930.405 rows=146409 loops=1)

53. 141.504 141.504 ↑ 1.0 1159586 1

Seq Scan on selections s (cost=0.00..22434.31 rows=1159631 width=12) (actual time=0.004..141.504 rows=1159586 loops=1)

54. 345.671 345.671 ↓ 1456.5 276741 1

Hash (cost=2715.07..2715.07 rows=190 width=4) (actual time=345.671..345.671 rows=276741 loops=1)

55. 291.004 291.004 ↓ 1456.5 276741 1

Nested Loop (cost=0.00..2715.07 rows=190 width=4) (actual time=0.070..291.004 rows=276741 loops=1)

56. 55.230 55.230 ↓ 1173.9 64563 1

Nested Loop (cost=0.00..2673.26 rows=55 width=4) (actual time=0.062..55.230 rows=64563 loops=1)

57. 18.564 18.564 ↓ 703.2 3516 1

Nested Loop (cost=0.00..2668.38 rows=5 width=8) (actual time=0.054..18.564 rows=3516 loops=1)

58. 10.147 10.147 ↓ 703.2 3516 1

Nested Loop (cost=0.00..2666.95 rows=5 width=4) (actual time=0.045..10.147 rows=3516 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 3516 1

Index Scan using events_keywords_event_id_keyword_id_idx on events_keywords ek (cost=0.00..2662.87 rows=47 width=8) (actual time=0.015..9.508 rows=3516 loops=1)

63. 7.032 7.032 ↑ 1.0 1 3516

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

64. 24.612 24.612 ↑ 1.2 18 3516

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

65. 193.689 193.689 ↑ 3.2 4 64563

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

66. 356.648 356.648 ↑ 1.0 1 89162

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

67. 267.486 267.486 ↑ 1.0 1 89162

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

68. 267.486 267.486 ↑ 1.0 1 89162

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

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 103543.543 ↓ 12874.0 373346 1

Hash (cost=30044.69..30044.69 rows=29 width=8) (actual time=103543.543..103543.543 rows=373346 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14584kB
74. 0.000 103483.725 ↓ 12874.0 373346 1

HashAggregate (cost=30044.11..30044.40 rows=29 width=8) (actual time=103383.001..103483.725 rows=373346 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. 103004.995 103004.995 ↓ 24048.6 697408 1

Hash Join (cost=3260.82..30044.03 rows=29 width=8) (actual time=1942.910..103004.995 rows=697408 loops=1)

76. 196.809 196.809 ↑ 1.0 1159586 1

Seq Scan on selections s (cost=0.00..22434.31 rows=1159631 width=12) (actual time=0.005..196.809 rows=1159586 loops=1)

77. 1942.771 1942.771 ↓ 25087.7 1580527 1

Hash (cost=3260.03..3260.03 rows=63 width=4) (actual time=1942.771..1942.771 rows=1580527 loops=1)

78. 1651.972 1651.972 ↓ 25087.7 1580527 1

Nested Loop (cost=0.00..3260.03 rows=63 width=4) (actual time=0.079..1651.972 rows=1580527 loops=1)

79. 281.364 281.364 ↓ 20841.6 375149 1

Nested Loop (cost=0.00..3246.35 rows=18 width=4) (actual time=0.070..281.364 rows=375149 loops=1)

80. 65.134 65.134 ↓ 10064.5 20129 1

Nested Loop (cost=0.00..3244.40 rows=2 width=8) (actual time=0.061..65.134 rows=20129 loops=1)

81. 20.038 20.038 ↓ 10064.5 20129 1

Nested Loop (cost=0.00..3243.82 rows=2 width=4) (actual time=0.053..20.038 rows=20129 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 20129 1

Index Scan using events_keywords_event_id_keyword_id_idx on events_keywords ek (cost=0.00..3239.75 rows=47 width=8) (actual time=0.016..16.309 rows=20129 loops=1)

86. 40.258 40.258 ↑ 1.0 1 20129

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

87. 161.032 161.032 ↑ 1.2 19 20129

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

88. 1125.447 1125.447 ↑ 3.2 4 375149

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

89. 1329.945 1329.945 ↓ 1.8 52 88663

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

  • 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 88663

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

  • Index Cond: (placement_id = s.placement_id)
93. 10.338 2784.049 ↓ 839.2 72169 1

Hash (cost=29503.16..29503.16 rows=86 width=8) (actual time=2784.049..2784.049 rows=72169 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 2820kB
94. 60.832 2773.711 ↓ 839.2 72169 1

HashAggregate (cost=29501.44..29502.30 rows=86 width=8) (actual time=2758.099..2773.711 rows=72169 loops=1)

95. 2431.198 2712.879 ↓ 1201.0 103290 1

Hash Join (cost=2717.44..29501.23 rows=86 width=8) (actual time=169.622..2712.879 rows=103290 loops=1)

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

Seq Scan on selections s (cost=0.00..22434.31 rows=1159631 width=12) (actual time=0.009..115.624 rows=1159586 loops=1)

97. 23.662 166.057 ↓ 657.7 124968 1

Hash (cost=2715.07..2715.07 rows=190 width=4) (actual time=166.057..166.057 rows=124968 loops=1)

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

Nested Loop (cost=0.00..2715.07 rows=190 width=4) (actual time=0.068..142.395 rows=124968 loops=1)

99. 0.000 31.765 ↓ 545.3 29989 1

Nested Loop (cost=0.00..2673.26 rows=55 width=4) (actual time=0.061..31.765 rows=29989 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 1647 1

Nested Loop (cost=0.00..2668.38 rows=5 width=8) (actual time=0.054..13.285 rows=1647 loops=1)

101. 9.047 9.047 ↓ 329.4 1647 1

Nested Loop (cost=0.00..2666.95 rows=5 width=4) (actual time=0.048..9.047 rows=1647 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 1647 1

Index Scan using events_keywords_event_id_keyword_id_idx on events_keywords ek (cost=0.00..2662.87 rows=47 width=8) (actual time=0.015..8.711 rows=1647 loops=1)

106. 3.294 3.294 ↑ 1.0 1 1647

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

107. 13.176 13.176 ↑ 1.2 18 1647

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

108. 89.967 89.967 ↑ 3.2 4 29989

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

  • Index Cond: (market_id = m.market_id)
109. 542.064 542.064 ↑ 1.0 1 180688

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

  • Index Cond: (outcome_id = sel.outcome_id)
110. 542.064 542.064 ↑ 1.0 1 180688

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

  • Index Cond: (market_id = o.market_id)
111. 361.376 361.376 ↑ 1.0 1 180688

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

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

Hash (cost=6733.88..6733.88 rows=19614 width=28) (actual time=127.272..127.272 rows=54674 loops=1)

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

Subquery Scan on kw_sport (cost=6341.60..6733.88 rows=19614 width=28) (actual time=93.174..113.918 rows=54674 loops=1)

114. 34.680 106.524 ↓ 2.8 54674 1

HashAggregate (cost=6341.60..6537.74 rows=19614 width=28) (actual time=93.173..106.524 rows=54674 loops=1)

115. 42.362 71.844 ↓ 2.8 54674 1

Hash Join (cost=294.04..6194.50 rows=19614 width=28) (actual time=0.684..71.844 rows=54674 loops=1)

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

Seq Scan on events_keywords ek (cost=0.00..4527.32 rows=313832 width=8) (actual time=0.007..28.815 rows=313790 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 54542 1

Hash (cost=6733.88..6733.88 rows=19614 width=28) (actual time=134.397..134.397 rows=54542 loops=1)

122. 7.420 120.744 ↓ 2.8 54542 1

Buckets: 2048 Batches: 1 Memory Usage: 3352kB -> Subquery Scan on kw_league (cost=6341.60..6733.88 rows=19614 width=28) (actual time=99.971..120.744 rows=54542 loops=1)

123. 35.747 113.324 ↓ 2.8 54542 1

HashAggregate (cost=6341.60..6537.74 rows=19614 width=28) (actual time=99.969..113.324 rows=54542 loops=1)

124. 47.234 77.577 ↓ 2.8 54542 1

Hash Join (cost=294.04..6194.50 rows=19614 width=28) (actual time=1.601..77.577 rows=54542 loops=1)

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

Seq Scan on events_keywords ek (cost=0.00..4527.32 rows=313832 width=8) (actual time=0.011..28.764 rows=313790 loops=1)

126. 0.282 1.579 ↓ 1.4 1086 1

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

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

Nested Loop (cost=0.00..284.39 rows=772 width=24) (actual time=0.028..1.297 rows=1086 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 1086 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=1086 loops=1)

  • Index Cond: (keyword_type_id = kt.keyword_type_id)
130. 361.376 361.376 ↑ 1.0 1 180688

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

  • 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 1121 1

Hash (cost=14488.82..14488.82 rows=1630 width=24) (actual time=101.467..101.467 rows=1121 loops=1)

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

HashAggregate (cost=14456.22..14472.52 rows=1630 width=24) (actual time=101.044..101.250 rows=1121 loops=1)

135. 17.476 80.161 ↓ 6.5 83838 1

Nested Loop (cost=0.00..14391.41 rows=12963 width=24) (actual time=0.057..80.161 rows=83838 loops=1)

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

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

  • Filter: (max_bet IS NOT NULL)
137. 60.569 60.569 ↑ 1.7 57 1637

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

  • Index Cond: (customer_id = cl.customer_id)
138. 542.064 542.064 ↑ 1.0 1 180688

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

  • Index Cond: (customer_id = c.customer_id)
139. 722.752 722.752 ↑ 1.0 1 180688

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

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