Get Object Count

I am doing the database retrieval with paging and am having a problem finding the “Get Object Count” block and cannot find that it has been superceded with another block.
Any guidance to where it is please ?.

Thanks

Hi David,

The block is there (see below). However, I am curious why you’d need it? The count operation is rather expensive from the performance perspective and paging can be done without it.

Regards,
Mark

Many thanks Mark. I searched so much for this block and my problem was so basic. I was using my scroll on the mouse and this caused me to miss several blocks I guess due to scrolling pages and not rows and this category has many and larger blocks to display.

With your reply I tried the scroll bar which did not work but then dragged the list with the mouse arrow and this allowed me to see all the blocks available which of course showed me the Get Object Count. I will make sure I do this in future.

The reason for using it was just using the example for my education in building blocks. I saw it and wanted to try it. Everything else fitted in place but not getting the correct block - and substituting with another - “Get group size/count” (thinking it was an enhanced replacement) got me nowhere of course and was really frustrating.

You have a fantastic application. I have not found it easy but every problem solved gives a little more understanding. Still a long way to go though.

Best Regards

Just a follow up question regarding @mark-piller 's statement:

The count operation is rather expensive from the performance perspective

Why? Or, rather: how expensive? We have a little interface where a user can delete content and we want to show them a dialog with the number of objects that would be deleted… is “Get object count” not the best block to use? If the user confirms they want to delete, we then perform a “bulk delete”… so in our particular case, loading all the objects (their ObjectId’s) into a variable and then getting the size of this array is smarter, since we then can just go ahead with the delete without having to do another API call… I’m really just curious about “expensive from a performance perspective”.

Also, please explain what the “group path” input needs (appears to be a required parameter). Thnx.

For a table with a very high number of records, any time you perform the count, the database locks the table to perform the operation. The locking prevents other operations to complete so they have to wait. As a result, not only the single count operation would take longer than average, but others would have to wait till the locking operation is complete. As a result, the compound nature of getting the count done makes it expensive as it is not only one client that is waiting, but all other clients that executed a query against the table would also have to wait.

Sometimes, it is possible to design an algorithm and altogether avoid the counts. For instance, if you need to get all the records by performing paging calls, getting the count is not necessary. You can simply check the result of the paged retrieval and if it is empty or less than the page size, you know you reached the end of the data set. In other cases, there may not be a way around it. Of course, you could implement a mechanism where you maintain an active count of your objects as they are created or deleted, but it increases the complexity of the solution.

Regarding this:

Could you please clarify what you’re referring to?

Regards,
Mark

1 Like

Sorry, I mean on the “Get Group Size / Count” block:

which I now see is a completely different block :blush:

Hi @Alex_Klein ,

This block belongs to the “data grouping” functionality and currently we are in the process of adding documentation for it.
I believe that you need to use “Get Object Count” block in your case instead.

Regards, Andriy

1 Like