Page extends Slice and knows the total number of elements and pages available by triggering a count query. From the Spring Data JPA documentation:
A
Pageknows about the total number of elements and pages available. It does so by the infrastructure triggering a count query to calculate the overall number. As this might be expensive depending on the store used,Slicecan be used as return instead. ASliceonly knows about whether there’s a nextSliceavailable which might be just sufficient when walking through a larger result set.