Recently started working on a existing project which heavily relies on awesome_nested_set gem and used one of it's method's self_and_descendants
refer here
This method is too heavy in terms of pulling all the children and triggers many queries. I have indexing in place but looking for a alternative to come out of this performance issue.
Sample Sqls that are triggered
q = Group.first
q.self_and_descendants
The above code triggers below queries, there are many more only some are pasted
Group::Translation Load (0.3ms) SELECT `group_translations`.* FROM `group_translations` WHERE `group_translations`.`group_id` = 2231
Group::Translation Load (0.3ms) SELECT `group_translations`.* FROM `group_translations` WHERE `group_translations`.`group_id` = 2233
Group::Translation Load (0.4ms) SELECT `group_translations`.* FROM `group_translations` WHERE `group_translations`.`group_id` = 2239
Group::Translation Load (0.3ms) SELECT `group_translations`.* FROM `group_translations` WHERE `group_translations`.`group_id` = 2240
Group::Translation Load (0.3ms) SELECT `group_translations`.* FROM `group_translations` WHERE `group_translations`.`group_id` = 2241
Group::Translation Load (0.3ms) SELECT `group_translations`.* FROM `group_translations` WHERE `group_translations`.`group_id` = 2242
Group::Translation Load (0.3ms) SELECT `group_translations`.* FROM `group_translations` WHERE `group_translations`.`group_id` = 2252