Speed up Grid DataSource Content loading (Count function) - Forum - Kendo UI Builder - Progress Community

Speed up Grid DataSource Content loading (Count function)

 Forum

Speed up Grid DataSource Content loading (Count function)

This question has suggested answer(s)

Hi together,


When I have a Grid with for example 1,000,000 article numbers in it and I'm using server side filtering then the first 10 articles will be loaded very fast.
But the Count function needs very much time.

Is there any way to speed up this? Or is there any functionality to show the articles before the Count function is ready?

All Replies
  • I have the same issue, as some of my tables have over 15M rows.  

    I created a sequence for the table and set its current value to the select count(*) of the table.

    I then created a create and delete trigger on the table to increment the sequence up and down. In the count method I simply got the current value of the sequence. It’s pretty instantaneous then… Hope this helps. Let me know if you need the code but it’s fairly straightforward.

  • I have the same issue, as some of my tables have over 15M rows.  

    I created a sequence for the table and set its current value to the select count(*) of the table.

    I then created a create and delete trigger on the table to increment the sequence up and down. In the count method I simply got the current value of the sequence. It’s pretty instantaneous then… Hope this helps. Let me know if you need the code but it’s fairly straightforward.

  • Hey, sorry for the late answer but it's pretty much to do at work actually ;-)

    This way sounds really good but I have one additional question.

    What are you doing when there's filter on the grid?

    For exampe:

    1,000,000 Articles on opening the view.

    Grid filter FOR EACH Article WHERE artNum BEGINS "A"

    Then there are only 1,000 Articles in the Grid but regardless, still 1,000,000 will be count?

    Did you got the current value of the sequence only when the filter is empty?

  • If you have a table with 1,000,000 records, and you provide no filter when initially searching (opening the view), then yes all 1,000,000 records will be counted. If you narrow your results by use of a filter (fields begins "a") then only the count of ALL MATCHING records will be returned, so 1,000 in your example. In either case, if you are using server-side paging only the first X records will be returned, but the full count will always be returned based on the filter used.

  • Thanks for the post Dustin, but this is what I allready know. My question at the beginning was to get the numResults faster than with the basic PRESELECT way in the MyCount function on server-side paging.

    Anything like 's answer or may like to show the first e.g. 10 records and increment records asynchronous while the user is able to look around in the grid.

    Just to don't let him wait. No wait until the count function is ready.

  • Using the default pattern (JFP) for filtering/paging, you must wait for the Count function to respond so that the grid is aware of how many total records will be present and it can update all of its extended object (pager, X of Y counts, etc.). To do what you're asking would require a bit of a shift in your filter pattern and more setup on the back-end to return the count WITH the page of results (thereby removing the 2nd call for the Count).

    How are you building your business entities currently, and how are they exposed?

  • First I'm creating a ProDataSet, then a Business Entity based on the ProDataSet. Then I'm adding the JFP annotation to the Read function for server-side filtering and adding a MyCount function with a invoke operation (got some errors with the count operation).

    @openapi.openedge.export(type="REST", useReturnValue="false", writeDataSetBeforeImage="false").

    @progress.service.resourceMapping(type="REST", operation="read", URI="?filter=~{filter~}", alias="", mediaType="application/json").

    @openapi.openedge.method.property (name="mappingType", value="JFP").

    @openapi.openedge.method.property (name="capabilities", value="ablFilter,top,skip,id,orderBy").

    In my Developing Environment the ABL Service will be automaticly Published to the Progress Application Server. In Production I'm exporting the ABL Service to a war File.

    In the Kendo UI Builder I'm adding a DataSource and add the Count function.

    Pretty basic Think. I got an example on the documentation.

    Is that what you wanted to know?