Using the count output from an agregate triggers a second server call when assigning it to the pagination total count from a table component ? I'm having a discussion with colleagues to understand how the agregate behaves with count ouput parameter.Is the platform smart enough to only make one server call and use the count output to get the number of records returned by the agregate in one single call ?
Hello,
If you use both the list and the count, two queries will be executed. The platform is smart enough to optimize aggregates and only retrieves what is actually needed.
Hi @José Pedro Mascarenhas ,
The platform is actually smart enough to handle this efficiently 🙂
When you use an Aggregate with pagination, OutSystems does not make a second server call just because you bind the Count output to the table’s TotalCount.
What happens under the hood is:
OutSystems generates one optimized query for the aggregate
That query retrieves both:
The paged data
The total record count (used for pagination)
So assigning the aggregate’s Count output to the table’s pagination TotalCount does not trigger an extra server request.
A second server call would only happen if:
You explicitly use another Aggregate or Data Action
Or you force a refresh/re-execution (e.g., with different inputs)
In short: One aggregate → one server call -Safe to use Count for pagination
This is standard and expected behavior in OutSystems.
regards,
Manish Jawla
Hello.
This is part of the training material and a likely topic for the certification exam.
The reason why is that on Aggregate you use Max Records and limit the number of records considered. Count needs to see all.
While an Aggregate does SELECT attributes FROM table WHERE condition LIMIT maxrecords
A Count does SELECT COUNT(*) FROM table WHERE condition
Reuses the aggregate, but is not the same query.
If you only use Count, it will only to Count. If you only use records, it will only do records. If you use both, it will need to run both.
Hi Jose',
Depending on the next node, it needs to use the output of the aggregate result so that the platform can optimize the highest priority query.
I remember this was knowledge from when you took the web developer specialist exam
And that's also why you should use aggregate instead of data action in Outsystems.