skip to main content
Formulating queries : Query options and optimizing response times : Improving performance when using inlineCount

Try DataDirect Cloud Now

Improving performance when using inlineCount

The $inlinecount 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 allpages and none:
inlineCountQueryOp = "$inlinecount=" "allpages" | "none")
Calculating the count for very large collections can take time. The default behavior for DataDirect Cloud differs for relational and cloud data sources:
*For relational data stores, by default, DataDirect Cloud 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, DataDirect Cloud 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 Setting OData options or by using the $inlineCount parameter. With a value of allpages, DataDirect Cloud will include the count in the response. For example:$inlinecount=allpages
With a value of none, DataDirect Cloud avoids obtaining a count and avoiding the associated overhead. For example:$inlinecount=none