explain.depesz.com

PostgreSQL's explain analyze made readable

Result: tFnB

Settings
# exclusive inclusive rows x rows loops node
1. 3.000 836.785 ↓ 8.3 25 1

Sort (cost=4,197.50..4,197.51 rows=3 width=37,270) (actual time=836.745..836.785 rows=25 loops=1)

  • Sort Key: a.activitylog_id DESC
  • Sort Method: top-N heapsort Memory: 120kB
2. 48.771 833.785 ↓ 461.7 1,385 1

Nested Loop Anti Join (cost=2.41..4,197.48 rows=3 width=37,270) (actual time=1.780..833.785 rows=1,385 loops=1)

3. 1.075 16.339 ↓ 461.7 1,385 1

Nested Loop Anti Join (cost=2.12..500.58 rows=3 width=37,270) (actual time=0.114..16.339 rows=1,385 loops=1)

4. 2.246 11.109 ↓ 461.7 1,385 1

Nested Loop Left Join (cost=1.84..499.64 rows=3 width=37,270) (actual time=0.101..11.109 rows=1,385 loops=1)

5. 2.463 8.863 ↓ 461.7 1,385 1

Nested Loop Left Join (cost=1.56..498.44 rows=3 width=37,265) (actual time=0.099..8.863 rows=1,385 loops=1)

6. 0.924 6.400 ↓ 461.7 1,385 1

Nested Loop (cost=1.28..497.49 rows=3 width=174) (actual time=0.096..6.400 rows=1,385 loops=1)

7. 0.007 0.082 ↑ 20.0 2 1

Nested Loop (cost=0.86..458.45 rows=40 width=16) (actual time=0.067..0.082 rows=2 loops=1)

8. 0.053 0.053 ↑ 20.0 2 1

Index Scan using user_follow_follower_user_id_idx on user_follow uf (cost=0.43..120.15 rows=40 width=8) (actual time=0.048..0.053 rows=2 loops=1)

  • Index Cond: (follower_user_id = 834734)
9. 0.022 0.022 ↑ 1.0 1 2

Index Scan using user_pkey on "user" u (cost=0.43..8.45 rows=1 width=8) (actual time=0.010..0.011 rows=1 loops=2)

  • Index Cond: (user_id = uf.user_id)
  • Filter: ((NOT is_banned) AND (user_id <> 834734))
10. 5.394 5.394 ↓ 692.0 692 2

Index Scan using activitylog_user_id_idx on activitylog a (cost=0.42..0.97 rows=1 width=175) (actual time=0.023..2.697 rows=692 loops=2)

  • Index Cond: (user_id = u.user_id)
  • Filter: ((NOT is_deleted) AND (NOT is_banned) AND (NOT is_scheduled) AND (ad_id IS NULL) AND (media_count > 0) AND (sport_type_id = 1) AND ((quality >= 3) OR (quality IS NULL) OR (user_id = 834734)) AND (CASE WHEN ((u.user_id IS NULL) OR (834734 <> user_id)) THEN false ELSE is_private END = is_private))
  • Rows Removed by Filter: 47
11. 0.000 0.000 ↓ 0.0 0 1,385

Index Scan using county_pkey on county co (cost=0.28..0.31 rows=1 width=37,107) (actual time=0.000..0.000 rows=0 loops=1,385)

  • Index Cond: (county_id = a.county_id)
12. 0.000 0.000 ↓ 0.0 0 1,385

Index Scan using region_id_idx on region r (cost=0.28..0.39 rows=1 width=21) (actual time=0.000..0.000 rows=0 loops=1,385)

  • Index Cond: (region_id = co.region_id)
13. 4.155 4.155 ↓ 0.0 0 1,385

Index Only Scan using user_block_idx on user_block ub (cost=0.29..0.31 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=1,385)

  • Index Cond: ((user_id = 834734) AND (blocked_user_id = a.user_id))
  • Heap Fetches: 0
14. 4.155 4.155 ↓ 0.0 0 1,385

Index Only Scan using activitylog_flag_idx on activitylog_flag af (cost=0.29..0.31 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=1,385)

  • Index Cond: ((activitylog_id = a.activitylog_id) AND (user_id = 834734))
  • Heap Fetches: 0
15.          

SubPlan (forNested Loop Anti Join)

16. 0.000 2.770 ↓ 0.0 0 1,385

Subquery Scan on sr_3 (cost=0.28..64.41 rows=1 width=65) (actual time=0.002..0.002 rows=0 loops=1,385)

17. 2.770 2.770 ↓ 0.0 0 1,385

Limit (cost=0.28..64.39 rows=1 width=158) (actual time=0.002..0.002 rows=0 loops=1,385)

18. 0.000 0.000 ↓ 0.0 0 1,385

Index Scan using ad_id_pk on ad a2 (cost=0.28..64.39 rows=1 width=158) (actual time=0.000..0.000 rows=0 loops=1,385)

  • Index Cond: (a.ad_id = ad_id)
19.          

SubPlan (forIndex Scan)

20. 0.000 0.000 ↓ 0.0 0

Subquery Scan on sr (cost=25.41..33.45 rows=1 width=652) (never executed)

21. 0.000 0.000 ↓ 0.0 0

Limit (cost=25.41..33.44 rows=1 width=636) (never executed)

22.          

Initplan (forLimit)

23. 0.000 0.000 ↓ 0.0 0

Index Only Scan using user_gear_favorite_log_idx on user_gear_favorite ugf (cost=0.29..8.31 rows=1 width=0) (never executed)

  • Index Cond: ((user_id = 834734) AND (gear_id = a2.gear_id))
  • Heap Fetches: 0
24. 0.000 0.000 ↓ 0.0 0

Index Only Scan using user_gear_inventory_log_idx on user_gear_inventory ugi (cost=0.29..8.31 rows=1 width=0) (never executed)

  • Index Cond: ((user_id = 834734) AND (gear_id = a2.gear_id))
  • Heap Fetches: 0
25. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=8.37..8.38 rows=1 width=0) (never executed)

26. 0.000 0.000 ↓ 0.0 0

Index Only Scan using user_gear_inventory_count_idx on user_gear_inventory ugi_1 (cost=0.29..8.36 rows=4 width=0) (never executed)

  • Index Cond: (gear_id = a2.gear_id)
  • Heap Fetches: 0
27. 0.000 0.000 ↓ 0.0 0

Index Scan using gear_pk on gear g (cost=0.42..8.45 rows=1 width=636) (never executed)

  • Index Cond: (gear_id = a2.gear_id)
28. 0.000 0.000 ↓ 0.0 0

Subquery Scan on sr_1 (cost=12.07..14.14 rows=1 width=841) (never executed)

29. 0.000 0.000 ↓ 0.0 0

Limit (cost=12.07..14.12 rows=1 width=835) (never executed)

30. 0.000 0.000 ↓ 0.0 0

Merge Join (cost=12.07..14.12 rows=1 width=835) (never executed)

  • Merge Cond: (r_1.region_id = p.region_id)
31. 0.000 0.000 ↓ 0.0 0

Index Scan using region_id_idx on region r_1 (cost=0.28..178.42 rows=3,951 width=18) (never executed)

32. 0.000 0.000 ↓ 0.0 0

Sort (cost=8.31..8.32 rows=1 width=829) (never executed)

  • Sort Key: p.region_id
33. 0.000 0.000 ↓ 0.0 0

Index Scan using property_id_pk on property p (cost=0.29..8.30 rows=1 width=829) (never executed)

  • Index Cond: (property_id = a2.property_id)
34. 0.000 0.000 ↓ 0.0 0

Subquery Scan on sr_2 (cost=0.43..8.47 rows=1 width=51) (never executed)

35. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.43..8.46 rows=1 width=65) (never executed)

36. 0.000 0.000 ↓ 0.0 0

Index Scan using user_pkey on "user" u_1 (cost=0.43..8.46 rows=1 width=65) (never executed)

  • Index Cond: (user_id = a2.user_id)
37. 27.700 90.025 ↑ 1.0 1 1,385

Aggregate (cost=21.87..21.88 rows=1 width=0) (actual time=0.065..0.065 rows=1 loops=1,385)

38. 62.325 62.325 ↓ 1.5 71 1,385

Index Only Scan using activitylog_like_log_idx on activitylog_like al (cost=0.43..21.75 rows=48 width=0) (actual time=0.014..0.045 rows=71 loops=1,385)

  • Index Cond: (activitylog_id = a.activitylog_id)
  • Heap Fetches: 8729
39. 1.385 85.870 ↓ 0.0 0 1,385

Subquery Scan on sr_4 (cost=156.94..156.96 rows=1 width=51) (actual time=0.062..0.062 rows=0 loops=1,385)

40. 1.385 84.485 ↓ 0.0 0 1,385

Limit (cost=156.94..156.95 rows=1 width=69) (actual time=0.061..0.061 rows=0 loops=1,385)

41. 2.770 83.100 ↓ 0.0 0 1,385

Sort (cost=156.94..156.95 rows=1 width=69) (actual time=0.060..0.060 rows=0 loops=1,385)

  • Sort Key: u_2.user_influence DESC
  • Sort Method: quicksort Memory: 25kB
42. 2.390 80.330 ↓ 0.0 0 1,385

Nested Loop (cost=122.08..156.93 rows=1 width=69) (actual time=0.057..0.058 rows=0 loops=1,385)

43. 23.545 77.560 ↓ 0.0 0 1,385

Merge Join (cost=121.65..148.46 rows=1 width=16) (actual time=0.055..0.056 rows=0 loops=1,385)

  • Merge Cond: (allike.user_id = uf_1.user_id)
44. 52.630 52.630 ↓ 1.4 69 1,385

Index Only Scan using activitylog_like_unique on activitylog_like allike (cost=0.43..26.91 rows=48 width=8) (actual time=0.013..0.038 rows=69 loops=1,385)

  • Index Cond: (activitylog_id = a.activitylog_id)
  • Filter: (user_id <> 834734)
  • Rows Removed by Filter: 0
  • Heap Fetches: 8272
45. 1.371 1.385 ↑ 20.0 2 1,385

Sort (cost=121.21..121.31 rows=40 width=8) (actual time=0.000..0.001 rows=2 loops=1,385)

  • Sort Key: uf_1.user_id
  • Sort Method: quicksort Memory: 25kB
46. 0.014 0.014 ↑ 20.0 2 1

Index Scan using user_follow_follower_user_id_idx on user_follow uf_1 (cost=0.43..120.15 rows=40 width=8) (actual time=0.004..0.014 rows=2 loops=1)

  • Index Cond: (follower_user_id = 834734)
47. 0.380 0.380 ↑ 1.0 1 95

Index Scan using user_pkey on "user" u_2 (cost=0.43..8.45 rows=1 width=69) (actual time=0.004..0.004 rows=1 loops=95)

  • Index Cond: (user_id = allike.user_id)
48. 6.925 163.430 ↑ 1.0 1 1,385

Aggregate (cost=145.16..145.17 rows=1 width=0) (actual time=0.118..0.118 rows=1 loops=1,385)

49. 16.620 156.505 ↓ 1.4 11 1,385

Nested Loop Anti Join (cost=1.42..145.14 rows=8 width=0) (actual time=0.017..0.113 rows=11 loops=1,385)

  • Join Filter: (ub_1.blocked_user_id = ac.user_id)
50. 7.312 139.885 ↓ 1.4 11 1,385

Nested Loop Anti Join (cost=1.13..136.72 rows=8 width=8) (actual time=0.016..0.101 rows=11 loops=1,385)

51. 25.771 101.105 ↓ 1.4 11 1,385

Nested Loop (cost=0.85..102.80 rows=8 width=16) (actual time=0.012..0.073 rows=11 loops=1,385)

52. 27.700 27.700 ↓ 1.4 11 1,385

Index Scan using activitylog_comment_idx on activitylog_comment ac (cost=0.42..35.16 rows=8 width=16) (actual time=0.006..0.020 rows=11 loops=1,385)

  • Index Cond: ((activitylog_id = a.activitylog_id) AND (is_deleted = false) AND (is_banned = false))
  • Filter: ((NOT is_banned) AND (NOT is_deleted))
53. 47.634 47.634 ↑ 1.0 1 15,878

Index Scan using user_pkey on "user" acu (cost=0.43..8.45 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=15,878)

  • Index Cond: (user_id = ac.user_id)
  • Filter: (NOT is_banned)
  • Rows Removed by Filter: 0
54. 31.468 31.468 ↓ 0.0 0 15,734

Index Only Scan using activitylog_comment_flag_idx on activitylog_comment_flag acf (cost=0.28..3.80 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=15,734)

  • Index Cond: ((activitylog_comment_id = ac.activitylog_comment_id) AND (user_id = 834734))
  • Heap Fetches: 0
55. 0.000 0.000 ↓ 0.0 0 15,734

Materialize (cost=0.29..8.31 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=15,734)

56. 0.002 0.002 ↓ 0.0 0 1

Index Only Scan using user_block_idx on user_block ub_1 (cost=0.29..8.30 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=1)

  • Index Cond: (user_id = 834734)
  • Heap Fetches: 0
57. 4.155 4.155 ↓ 0.0 0 1,385

Index Only Scan using activitylog_like_unique on activitylog_like al_1 (cost=0.43..8.46 rows=1 width=0) (actual time=0.003..0.003 rows=0 loops=1,385)

  • Index Cond: ((activitylog_id = a.activitylog_id) AND (user_id = 834734))
  • Heap Fetches: 0
58. 0.000 0.000 ↓ 0.0 0

Index Scan using activitylog_like_user_idx on activitylog_like al_2 (cost=0.43..2,963.67 rows=827 width=8) (never executed)

  • Index Cond: (user_id = 834734)
59. 1.385 6.925 ↓ 0.0 0 1,385

Subquery Scan on sr_5 (cost=0.42..518.24 rows=1 width=36) (actual time=0.005..0.005 rows=0 loops=1,385)

60. 4.100 5.540 ↓ 0.0 0 1,385

Index Scan using activitylog_species_idx on activitylog_species als (cost=0.42..518.23 rows=1 width=28) (actual time=0.004..0.004 rows=0 loops=1,385)

  • Index Cond: (activitylog_id = a.activitylog_id)
61.          

SubPlan (forIndex Scan)

62. 0.060 1.440 ↑ 18.0 1 6

Subquery Scan on s_1 (cost=509.25..509.79 rows=18 width=828) (actual time=0.239..0.240 rows=1 loops=6)

63. 0.018 1.380 ↑ 18.0 1 6

Sort (cost=509.25..509.30 rows=18 width=828) (actual time=0.230..0.230 rows=1 loops=6)

  • Sort Key: t.parent_species_id NULLS FIRST
  • Sort Method: quicksort Memory: 25kB
64.          

CTE t

65. 0.326 0.963 ↑ 13.8 267 1

Recursive Union (cost=0.00..425.83 rows=3,691 width=173) (actual time=0.009..0.963 rows=267 loops=1)

66. 0.063 0.063 ↑ 1.0 31 1

Seq Scan on species (cost=0.00..8.67 rows=31 width=169) (actual time=0.003..0.063 rows=31 loops=1)

  • Filter: (parent_species_id IS NULL)
  • Rows Removed by Filter: 236
67. 0.212 0.574 ↑ 3.1 118 2

Hash Join (cost=10.07..34.33 rows=366 width=173) (actual time=0.163..0.287 rows=118 loops=2)

  • Hash Cond: (s.parent_species_id = t_1.species_id)
68. 0.214 0.214 ↑ 1.0 267 2

Seq Scan on species s (cost=0.00..8.67 rows=267 width=169) (actual time=0.002..0.107 rows=267 loops=2)

69. 0.082 0.148 ↑ 2.3 134 2

Hash (cost=6.20..6.20 rows=310 width=12) (actual time=0.074..0.074 rows=134 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 20kB
70. 0.066 0.066 ↑ 2.3 134 2

WorkTable Scan on t t_1 (cost=0.00..6.20 rows=310 width=12) (actual time=0.002..0.033 rows=134 loops=2)

71. 1.362 1.362 ↑ 18.0 1 6

CTE Scan on t (cost=0.00..83.05 rows=18 width=828) (actual time=0.036..0.227 rows=1 loops=6)

  • Filter: (species_id = als.species_id)
  • Rows Removed by Filter: 266
72. 1.385 4.155 ↑ 1.0 1 1,385

Aggregate (cost=12.61..12.62 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=1,385)

73. 1.367 2.770 ↓ 0.0 0 1,385

Nested Loop (cost=0.56..12.61 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=1,385)

74. 1.385 1.385 ↓ 0.0 0 1,385

Index Scan using activitylog_species_idx on activitylog_species als_1 (cost=0.42..8.44 rows=1 width=12) (actual time=0.001..0.001 rows=0 loops=1,385)

  • Index Cond: (activitylog_id = a.activitylog_id)
75. 0.018 0.018 ↑ 1.0 1 6

Index Only Scan using species_pkey on species s_2 (cost=0.15..4.17 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=6)

  • Index Cond: (species_id = als_1.species_id)
  • Heap Fetches: 0
76. 9.695 31.855 ↑ 1.0 1 1,385

Subquery Scan on sr_6 (cost=1.29..25.40 rows=1 width=51) (actual time=0.022..0.023 rows=1 loops=1,385)

77. 2.770 22.160 ↑ 1.0 1 1,385

Limit (cost=1.29..25.39 rows=1 width=81) (actual time=0.015..0.016 rows=1 loops=1,385)

78. 4.155 19.390 ↑ 1.0 1 1,385

Nested Loop Left Join (cost=1.29..25.39 rows=1 width=81) (actual time=0.014..0.014 rows=1 loops=1,385)

  • Join Filter: (following_me.follower_user_id = u_3.user_id)
79. 1.385 11.080 ↑ 1.0 1 1,385

Nested Loop Left Join (cost=0.86..16.91 rows=1 width=73) (actual time=0.008..0.008 rows=1 loops=1,385)

  • Join Filter: (i_am_following.user_id = u_3.user_id)
80. 4.155 4.155 ↑ 1.0 1 1,385

Index Scan using user_pkey on "user" u_3 (cost=0.43..8.45 rows=1 width=65) (actual time=0.003..0.003 rows=1 loops=1,385)

  • Index Cond: (user_id = a.user_id)
81. 5.540 5.540 ↑ 1.0 1 1,385

Index Only Scan using user_follow_unique on user_follow i_am_following (cost=0.43..8.45 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=1,385)

  • Index Cond: ((user_id = a.user_id) AND (follower_user_id = 834734))
  • Heap Fetches: 1385
82. 4.155 4.155 ↑ 1.0 1 1,385

Index Only Scan using user_follow_unique on user_follow following_me (cost=0.43..8.45 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=1,385)

  • Index Cond: ((user_id = 834734) AND (follower_user_id = a.user_id))
  • Heap Fetches: 1310
83. 15.235 264.535 ↑ 1.0 2 1,385

Subquery Scan on sr_7 (cost=145.42..145.45 rows=2 width=82) (actual time=0.185..0.191 rows=2 loops=1,385)

84. 1.385 249.300 ↑ 1.0 2 1,385

Limit (cost=145.42..145.43 rows=2 width=74) (actual time=0.179..0.180 rows=2 loops=1,385)

85. 13.850 247.915 ↑ 4.0 2 1,385

Sort (cost=145.42..145.44 rows=8 width=74) (actual time=0.178..0.179 rows=2 loops=1,385)

  • Sort Key: ac_1.activitylog_comment_id
  • Sort Method: top-N heapsort Memory: 26kB
86. 32.993 234.065 ↓ 1.4 11 1,385

Nested Loop Anti Join (cost=0.99..145.34 rows=8 width=74) (actual time=0.020..0.169 rows=11 loops=1,385)

  • Join Filter: (ub_2.blocked_user_id = ac_1.user_id)
87. 7.024 58.170 ↓ 1.4 11 1,385

Nested Loop Anti Join (cost=0.71..69.08 rows=8 width=74) (actual time=0.007..0.042 rows=11 loops=1,385)

88. 19.390 19.390 ↓ 1.4 11 1,385

Index Scan using activitylog_comment_idx on activitylog_comment ac_1 (cost=0.42..35.16 rows=8 width=74) (actual time=0.004..0.014 rows=11 loops=1,385)

  • Index Cond: ((activitylog_id = a.activitylog_id) AND (is_deleted = false) AND (is_banned = false))
  • Filter: ((NOT is_banned) AND (NOT is_deleted))
89. 31.756 31.756 ↓ 0.0 0 15,878

Index Only Scan using activitylog_comment_flag_idx on activitylog_comment_flag acf_1 (cost=0.28..3.80 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=15,878)

  • Index Cond: ((activitylog_comment_id = ac_1.activitylog_comment_id) AND (user_id = 834734))
  • Heap Fetches: 0
90. 0.000 0.000 ↓ 0.0 0 15,878

Materialize (cost=0.29..8.31 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=15,878)

91. 0.002 0.002 ↓ 0.0 0 1

Index Only Scan using user_block_idx on user_block ub_2 (cost=0.29..8.30 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=1)

  • Index Cond: (user_id = 834734)
  • Heap Fetches: 0
92.          

SubPlan (forNested Loop Anti Join)

93. 79.390 142.902 ↑ 1.0 1 15,878

Subquery Scan on sr2 (cost=0.43..8.47 rows=1 width=51) (actual time=0.008..0.009 rows=1 loops=15,878)

94. 15.878 63.512 ↑ 1.0 1 15,878

Limit (cost=0.43..8.46 rows=1 width=65) (actual time=0.004..0.004 rows=1 loops=15,878)

95. 47.634 47.634 ↑ 1.0 1 15,878

Index Scan using user_pkey on "user" u_4 (cost=0.43..8.46 rows=1 width=65) (actual time=0.003..0.003 rows=1 loops=15,878)

  • Index Cond: (user_id = ac_1.user_id)
96. 16.620 52.630 ↑ 1.5 2 1,385

Subquery Scan on sr_8 (cost=0.42..66.15 rows=3 width=36) (actual time=0.028..0.038 rows=2 loops=1,385)

97. 27.409 36.010 ↑ 1.5 2 1,385

Index Scan using user_media_activitylog1_idx on user_media um (cost=0.42..66.11 rows=3 width=62) (actual time=0.021..0.026 rows=2 loops=1,385)

  • Index Cond: ((activitylog_id = a.activitylog_id) AND (media_type = 1))
98.          

SubPlan (forIndex Scan)

99. 8.601 8.601 ↑ 1.0 1 2,867

Aggregate (cost=17.65..17.66 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=2,867)

100. 0.000 0.000 ↓ 0.0 0 2,867

Seq Scan on video_view vv (cost=0.00..17.65 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=2,867)

  • Filter: ((seconds_viewed >= 3) AND (um.user_media_id = user_media_id))
101. 6.925 58.170 ↓ 0.0 0 1,385

Subquery Scan on sr_12 (cost=1.57..67.19 rows=2 width=667) (actual time=0.013..0.042 rows=0 loops=1,385)

102. 2.770 51.245 ↓ 0.0 0 1,385

Limit (cost=1.57..67.17 rows=2 width=675) (actual time=0.011..0.037 rows=0 loops=1,385)

103. 2.608 48.475 ↓ 0.0 0 1,385

Result (cost=1.57..67.17 rows=2 width=675) (actual time=0.010..0.035 rows=0 loops=1,385)

  • One-Time Filter: (NOT a.is_deleted)
104. 1.676 15.235 ↓ 0.0 0 1,385

Nested Loop Left Join (cost=1.57..27.62 rows=2 width=675) (actual time=0.006..0.011 rows=0 loops=1,385)

105. 0.291 12.465 ↓ 0.0 0 1,385

Nested Loop Left Join (cost=1.28..26.97 rows=2 width=667) (actual time=0.005..0.009 rows=0 loops=1,385)

106. 1.676 11.080 ↓ 0.0 0 1,385

Nested Loop Left Join (cost=1.00..26.32 rows=2 width=659) (actual time=0.004..0.008 rows=0 loops=1,385)

107. 1.967 8.310 ↓ 0.0 0 1,385

Nested Loop (cost=0.71..25.63 rows=2 width=651) (actual time=0.004..0.006 rows=0 loops=1,385)

108. 4.155 4.155 ↓ 0.0 0 1,385

Index Scan using activitylog_gear_log_pk on activitylog_gear alg (cost=0.29..8.73 rows=2 width=8) (actual time=0.003..0.003 rows=0 loops=1,385)

  • Index Cond: (activitylog_id = a.activitylog_id)
109. 2.188 2.188 ↑ 1.0 1 547

Index Scan using gear_pk on gear g_1 (cost=0.42..8.44 rows=1 width=651) (actual time=0.003..0.004 rows=1 loops=547)

  • Index Cond: (gear_id = alg.gear_id)
110. 1.094 1.094 ↓ 0.0 0 547

Index Scan using user_gear_favorite_log_idx on user_gear_favorite ugf_1 (cost=0.29..0.34 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=547)

  • Index Cond: ((user_id = 834734) AND (gear_id = g_1.gear_id))
  • Filter: (sport_type_id = 1)
111. 1.094 1.094 ↓ 0.0 0 547

Index Only Scan using user_gear_inventory_pk on user_gear_inventory ugi_2 (cost=0.29..0.32 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=547)

  • Index Cond: ((user_id = 834734) AND (gear_id = g_1.gear_id) AND (sport_type_id = 1))
  • Heap Fetches: 0
112. 1.094 1.094 ↓ 0.0 0 547

Index Only Scan using user_gear_cart_log_idx on user_gear_cart ugc (cost=0.29..0.31 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=547)

  • Index Cond: ((user_id = 834734) AND (gear_id = g_1.gear_id) AND (is_deleted = false))
  • Filter: (NOT is_deleted)
  • Heap Fetches: 0
113.          

SubPlan (forResult)

114. 4.376 30.632 ↑ 1.0 1 547

Subquery Scan on sr_11 (cost=19.75..19.77 rows=1 width=107) (actual time=0.055..0.056 rows=1 loops=547)

115. 2.188 26.256 ↑ 1.0 1 547

Sort (cost=19.75..19.75 rows=1 width=112) (actual time=0.048..0.048 rows=1 loops=547)

  • Sort Key: mg.is_preferred DESC, mg.price
  • Sort Method: quicksort Memory: 25kB
116. 8.205 24.068 ↑ 1.0 1 547

Hash Join (cost=8.45..19.74 rows=1 width=112) (actual time=0.038..0.044 rows=1 loops=547)

  • Hash Cond: (m_1.merchant_id = mg.merchant_id)
117. 3.829 3.829 ↑ 1.0 30 547

Seq Scan on merchant m_1 (cost=0.00..1.30 rows=30 width=8) (actual time=0.001..0.007 rows=30 loops=547)

118. 0.547 2.735 ↑ 1.0 1 547

Hash (cost=8.44..8.44 rows=1 width=112) (actual time=0.005..0.005 rows=1 loops=547)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
119. 2.188 2.188 ↑ 1.0 1 547

Index Scan using merchant_gear_log_idx on merchant_gear mg (cost=0.42..8.44 rows=1 width=112) (actual time=0.003..0.004 rows=1 loops=547)

  • Index Cond: (gear_id = g_1.gear_id)
120.          

SubPlan (forHash Join)

121. 1.641 5.470 ↑ 1.0 1 547

Subquery Scan on sr_9 (cost=8.45..8.47 rows=1 width=82) (actual time=0.009..0.010 rows=1 loops=547)

122. 1.641 3.829 ↑ 1.0 1 547

Sort (cost=8.45..8.46 rows=1 width=70) (actual time=0.007..0.007 rows=1 loops=547)

  • Sort Key: gm.sort_num, gm.created_ts
  • Sort Method: quicksort Memory: 25kB
123. 2.188 2.188 ↑ 1.0 1 547

Index Scan using gear_media_log_idx on gear_media gm (cost=0.42..8.44 rows=1 width=70) (actual time=0.004..0.004 rows=1 loops=547)

  • Index Cond: ((gear_id = mg.gear_id) AND (merchant_id = mg.merchant_id))
124. 1.641 3.829 ↑ 1.0 1 547

Subquery Scan on sr_10 (cost=0.00..1.39 rows=1 width=61) (actual time=0.006..0.007 rows=1 loops=547)

125. 0.547 2.188 ↑ 1.0 1 547

Limit (cost=0.00..1.38 rows=1 width=45) (actual time=0.004..0.004 rows=1 loops=547)

126. 1.641 1.641 ↑ 1.0 1 547

Seq Scan on merchant m (cost=0.00..1.38 rows=1 width=45) (actual time=0.003..0.003 rows=1 loops=547)

  • Filter: (merchant_id = mg.merchant_id)
  • Rows Removed by Filter: 18