Open amrelhewy09 opened 1 year ago
The pagination works but does the extra select COUNT(*) query for no reason.
chat_applications = RailsCursorPagination::Paginator.new(ChatApplication.all, first: 2, after: after).fetch
Why does this query do 2 extra queries?
chat_app | (0.4ms) SELECT COUNT(*) FROM `chat_applications` WHERE (`chat_applications`.`id` > 2) chat_app | ↳ app/controllers/api/v1/chat_applications_controller.rb:20:in `index' chat_app | (0.2ms) SELECT COUNT(*) FROM `chat_applications`
This is because, depending on the direction, either previous_page? or next_page? will wind up querying the total even though it has been disable in the results.
The pagination works but does the extra select COUNT(*) query for no reason.
Why does this query do 2 extra queries?