Skip to content

Specification, Pageable results and another totals alongside with count #3800

@detinho

Description

@detinho

A business requirement was presented to add totals to paged tables, demanding the summation of selected columns across all records, regardless of the displayed page.

The findAll(Specification, Pageable) method in Spring Data already executes two queries: one for the paginated data and another for the total count. I sought a way to optimize this process by calculating the totals within the same query, but found no native solution.

To avoid the overhead of an additional query, I implemented the pagination, count, and sum logic directly in the application, achieving the desired result.

I am opening this issue to check if this is a common use case and to discuss the feasibility of a generic solution within the framework itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions