LazyQueryContainer with PagedTable - too many count requests!!

Hi all,
I’ve just been implementing a search screen with LazyQueryContainer and PagedTable (both addons) and found that I am getting some pretty heavy queries executed against the services. To be more specific, I’m using a hand rolled ‘Query’ - called ‘UserQuery’. Every population request results in 8 hits to the Query.size() method - which in turn forces my database to execute the count query 8 times. Is this a normal occurrence? From implementing this hand-rolled before, the normal thing would be to execute the count ONCE per page request. Have I missed something?

Thanks

It is indeed the case that size() is called extremely often in certain settings (such as table loading), which led me to cache the results. In an extension I wrote, I had to cache the values returned for size(), and implement a way to invalidate the cached value). The problem is that there may be other threads inserting in the database, so there are limits to any caching strategy.

I am beginning to wonder if it is the PagedTable component, or just the LazyQueryContainer. Seems that if I swap back out to normal Table, there are about 11 hits when scrolling outside the initial paged set. Although this would be acceptable if looking at a ‘static’ list of country flags, when hitting the datastore 11times at a table with 10,000 records it seems quite dramatic! I wonder if this has been raised before - as if people have hundreds of concurrent users online paging their results, it could bring the db to its knees.

Luckily for us, we have the source so I’ll start hacking away. I prefer not to modify the addons - however :slight_smile:

Thanks

Hi, if you need more optimized paged table, check what add-ons is using this project:

https://github.com/ondrej-kvasnovsky/lazy-loaded-paged-table
(there are no additional calls, it is quite tuned I would say)