Noticed large amount of repetition in an IN
statement...
... it might be a sign of "problem", "code smell" or something to consider tidying.
Executing action: index
T+83.9 ms
Reader
2.5 ms
app/models/category_list.rb:84:in `find_categories'
app/models/category_list.rb:18:in `initialize'
app/controllers/categories_controller.rb:22:in `new'
app/controllers/categories_controller.rb:22:in `index'
lib/middleware/anonymous_cache.rb:129:in `call'
config/initializers/100-quiet_logger.rb:10:in `call_with_quiet_assets'
config/initializers/100-silence_logger.rb:26:in `call'
lib/middleware/request_tracker.rb:73:in `call'
lib/scheduler/defer.rb:85:in `process_client'
lib/middleware/unicorn_oobgc.rb:95:in `process_client'
SELECT "categories".* FROM "categories" WHERE (NOT categories.read_restricted or categories.id in (
2, 2, 4, 4,
4, 4, 35, 35,
35, 35, 35, 35,
35, 35, 35, 35,
35, 35, 35, 38,
38, 38, 38, 38,
38, 38, 38, 38,
38, 38, 38, 38,
38, 38, 38, 38,
38, 38, 38, 38,
38, 38, 38, 38,
38, 38, 38, 38,
38, 38, 38, 38,
38, 38, 38, 38,
38, 38, 38, 38,
38, 38, 38, 38,
38, 38, 38, 38,
38, 38, 38, 38,
38, 38, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 40, 40,
40, 40, 42, 42,
42, 42, 42, 46,
46, 46, 46, 46,
47, 47, 47, 47,
47, 48, 48, 48,
48, 48, 49, 49,
49, 49, 49, 52,
52, 52, 52, 52,
56, 56, 56, 56,
56, 57, 57, 57,
57, 57, 58, 58,
58, 58, 58, 59,
59, 59, 59, 59,
60, 60, 60, 60,
60, 61, 61, 61,
61, 61, 62, 62,
62, 62, 62, 63,
63, 63, 63, 63,
64, 64, 64, 64,
64, 65, 65, 65,
65, 65, 66, 66,
66, 66, 66, 67,
67, 67, 67, 67,
68, 68, 68, 68,
68, 72, 72, 72,
72, 72, 75, 75,
75, 75, 75, 79,
79, 79, 79, 79,
80, 80, 80, 80,
80, 81, 81, 81,
81, 81, 82, 82,
82, 82, 82, 83,
83, 83, 83, 83,
84, 84, 84, 84,
84, 85, 85, 85,
85, 85, 86, 86,
86, 86, 86, 87,
87, 87, 87, 87,
91, 91, 91, 91,
91, 92, 92, 92,
92, 92, 93, 93,
93, 93, 93, 94,
94, 94, 94, 94,
95, 95, 95, 95,
95, 96, 96, 96,
96, 96, 97, 97,
97, 97, 97, 98,
98, 98, 98, 98,
99, 99, 100, 100,
100, 100, 100, 101,
101, 101, 101, 101,
102, 102, 102, 102,
102, 103, 103, 103,
103, 103, 104, 104,
104, 104, 104, 105,
105, 105, 105, 105,
106, 106, 106, 106,
106, 107, 107, 107,
107, 108, 108, 108,
108, 108, 109, 109,
109, 109, 109, 110,
110, 111, 111, 111,
114, 114, 115, 115,
115, 115, 115 )) ORDER BY COALESCE(categories.posts_week, 0) DESC, COALESCE(categories.posts_month, 0) DESC, COALESCE(categories.posts_year, 0) DESC, id ASC
Yes, there are a large number of categories and sub-categories.
Probably just "unique" the ID's?