As select
statement without an order by
clause should be considered to have no particular order (see this question), it seems to be unreliable to use PagingAndSortingRepository.findAll(Pageable pageable)
, because there is no guarantee that each page will have unique rows. Is it so?
To elaborate on my concern, assume we have 20 rows with ids in range [1, 20]. Assume client makes request for the first page of size = 10, and gets rows with ids [1, 10]. Assume client makes a request for the second page. Expected result is to see rows with ids [11, 20]. However, since there is no guarantee on ordering, the second query is not guaranteed to return [11, 20], and can include any rows with ids [1, 10].
Is the concern valid?