1

I have Big data my mysql in some table (10000000)

 Pageable setPage = PageRequest.of(form.getCurrentPage(),
                form.getListSizeInPage(),
                Sort.by("num").descending());

So. When i call the Query like this.

 Page<Entity> getList = repo.findall(setPage );

and mysql show findall query's call time is very short under 5sec. But the page api has call

 select count(column) fomr table;

this query call time during 15sec over

could i change or edit count query?

jjosjoahu
  • 131
  • 7
  • Hi, very interesting, perhaps this answer might offer some useful info https://stackoverflow.com/questions/10976328/mysql-count-performance-on-very-big-tables It might require a separate counter... Not sure – IronMan Mar 25 '20 at 01:53

1 Answers1

0

You can define your own method and annotated it with@Query.

This allows you to provide a custom countQuery or to return a Slice which doesn't use a count query at all.

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348