The problem is that I want to avoid a count query in the database in order to find the total rows.Why? If you do it once and use some form of caching the result, it is not expensive at all. And liberates you from lots of other possible problems like you describe you have
Hi and thanks for your reply,
I have measured the execution time of a count query in a table with 2 million of rows stored in a postgresql database and I founded about 4 seconds. I want to avoid, if possible, that delay when the user requests for the first time a data page.
So, I want to have an approximated count (like google) and to adapt that value when it is needed. I have tried to resolve my problem using a scrollerListener but the method does not called when I jump in a page greater than the (currently calculated) final page.