Improving performance when using Count
- Last Updated: April 11, 2025
- 1 minute read
- Hybrid Data Pipeline
- Version 4.6
- Documentation
The $count OData system query option
includes the count of the number of entities that satisfy a query in the response. The
count is included in the first page in server-side paging, and in every page when the
client controls paging. Possible values for the parameter include true and false:
inlineCountQueryOp = "$count=" "true" | "false")
- For relational data stores, by default, Hybrid Data Pipeline sends a separate query to get the count before requesting the records. This behavior tends to result in a quicker response for the first page of results. However, it requires two queries to be executed rather than one. And, in some data sources, the count(*) aggregate is not efficiently implemented.
- For cloud-based data stores, by default, Hybrid Data Pipeline fetches the entire result before returning the first page. For small results, this approach will always be faster. However, this approach may have longer initial response time for the first page if the result is large.
This behavior can be changed in the data source definition, as described
in Configuring data sources for OData Version 4 connectivity or by using the
$count parameter. With a value of true, Hybrid Data Pipeline will include the count in the
response. For example:
https://<myserver>:<port>/api/odata4/OracleOPTest/Customers?$count=true
With a value of false, Hybrid Data
Pipeline avoids obtaining a count and avoiding the associated overhead. For example:
https://<myserver>:<port>/api/odata4/OracleOPTest/Customers?$count=false