offset/limit vs page/pagesize

What is the difference between offset/limit vs page/pagesize ? I see when using page/pagesize grid loads comparatively faster

They are essentially just expressing the same thing in bit different ways. In recent Vaadin versions, the Grid fetches data from the backend with deterministic pages, so ready calculated page/pagesize is there for better developer experience.

There shouldn’t be a difference in performance. Maybe something wrong in your version of code that is using offset/limit :thinking:

You can check the query done and see if they are different

Looks there is no count query getting executed when using Page/PageSize. I’m not seeing it and FYI I tested this with H2 DB

That depends on which version of the lazy loading API you are using. You can also use offset+limit and not provide the total size and visa versa.

is it ? I see the total count query is getting executed automatically.

can you provide an example where I can ignore this count query ? I’m migrating from V14 to V24

If you use setItems(CallbackDataProvider.FetchCallback<T,F> fetchCallback, CallbackDataProvider.CountCallback<T,F> countCallback) or some of the old school DataProvider variants, the count query is made&required. If you use the setItems(CallbackDataProvider.FetchCallback<T,F> fetchCallback) variant, the count query is not needed. It doesn’t matter if you use page/pagesize or offset/limit from the query object to determine which items to return.