Search code examples
rx-java2micronautmicronaut-data

Micronaut Data - Pageable or Flowable.skip().limit()?


I was wondering if someone could explain the differences and pros and cons of each approach. Ie. the underlying queries to DBs, performance, etc

  1. RxJava approach
RxJavaCrudRepository.findAll().skip(offset).limit(max)
  1. Pageable approach
CrudRepository.findAll(Pageable.from(offset, max))

Solution

  • So after some digging around and debugging the resulting SQL, I have come to the conclusion that: Approach 1 doesnt do any under-the-hood magic and uses a SELECT without LIMIT, fetching all rows from DB and then applying the skip/offset. This means it definitely should not be used and approach 2 is the way to go.