Anyone come up with a hack for serverside processing where totals are not needed?

Anyone come up with a hack for serverside processing where totals are not needed?

mihomesmihomes Posts: 150Questions: 19Answers: 0
edited September 2020 in DataTables 1.10

Just wondering if anyone has modified/hacked the default behavior so totals are not needed for pagination when using serverside processing?

I've come to a point where certain results are upwards of 3 million rows and there is an obvious delay when paging through them. I tracked the majority of the time being spent on COUNT() for the total results and filtered totals while the query to actually get the results is extremely fast. Indexes are being used so there is no way to make it faster... it just takes COUNT() longer to get totals when the count is that high.

In my head I was thinking... well, I can just put a previous/next button for paging and skip the totals then every page is going to return extremely fast (minus some crazy searches and sorting applied). What if there was something where the serverside script limit was one more than the current paging setting? Paging is set to 50 so the serverside script attempts to return 51. It only displays a max of 50, but if 51 were returned we know there is another page available and show the 'next' button.

Unfortunately speed is at the beginning stages of being annoying. Serverside is necessary because of the amount of rows/data in our database, but at the same time the two COUNT()s required are also becoming a drawback with higher result sets.

Replies

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    Have a look at this thread which discusses what you are looking for to some extent.

    Something like this is going to have to get implemented in DataTables, although it will come with restrictions (no Scroller for example).

    Allan

  • mihomesmihomes Posts: 150Questions: 19Answers: 0

    That would be fantastic. I guess this isn't the first time this has come up. I personally don't use any of the extensions anyways so no worries about Scroller. I'll keep an eye out.

This discussion has been closed.