Query Entity throwing error while retrieving the data for total count

Certified Senior Developer

Hi All,

I am having a weird issue in executing the query entity. I have a query entity rule which returns the totalcount based on the date range(which is ideally current date/day). It is throwing error in some scenarios and testing this rule certain time, we can see the data is being populated.

Any help would be highly appreciated.

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    HOw much does the query takes when executed directly in SQL?

    Maybe your filter using dates and between operator is too slow. Do you have an index created in that field?

    Try removing the filter or filtering by Pk, in order to check if the problem is related with that field. 

  • 0
    Certified Lead Developer

    If you're querying only to get the TotalCount, your PagingInfo should pass in a BatchSize of zero, which will cause the query to return zero rows of data (but it should still return an accurate TotalCount).  I notice you're already passing in a BatchSize of 1, but using 0 will be just one notch more potentially efficient for this use case.

    However the fact that you're getting this error even with a batchsize of 1 suggests, as others have pointed out, that your query might be timing out.  What happens when you run a simple SQL query on the data directly in the DB?  I've found that in the case of queries that don't perform well on the Appian side to this extent, there's also an accompanying obvious-to-severe delay when running a SQL query - typically this has been in Views with severe inefficiencies accidentally included, or actual breaking bugs.

  • 0
    Certified Senior Developer

    there is a need to optimization view, if it is from view, add the index to the column on which filter is applied can improve the performance, it is 95+ cases is timeout issue