What if the paging speed of spring data jpa local query is slow?

problem description

the paging speed of spring data jpa local query is very slow, so it should be

that all entries are found and then paged.

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)
@ Query (nativeQuery = true,

        value = "select * from anime a " +
        "left join anime_user au on (a.id = au.anime_id) and au.user_id = ?1 " +
        "order by ?-sharp{-sharppageable}",
        countQuery = "select count(*) from anime")
Page<Anime> getAnimeRankList(long id, Pageable pageable);

what result do you expect? What is the error message actually seen?

the same logic is used in mybatis and pagehelper will quickly get the result. I don"t know if jpa has a good solution

.
Dec.21,2021
Menu