Skip to content

It still fetches the count of all records even if I omit the with_total #132

@amrelhewy09

Description

@amrelhewy09

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`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions