In case counts for queries are executed by JDBC, this can take some time because of one of the following reasons:
In some cases the default timeout value of 5 seconds is not long enough, which results in a timeout of the query and a rollback of the complete transaction.
To avoid the timeout you can change the timeout value via the server-side property Carnot.Engine.Tuning.GetCountDefaultTimeout. The higher the value of this property, the longer an implicit JDBC count will wait for the correct result. On the other hand this might result in slow responses in case the count cannot be executed in a reasonable time. Try to keep this value as low as possible and as high as necessary.
For details on this property refer to section Tuning of chapter Server Side Properties.
Do not mistake this property for the timeout value which can be set for queries in general by the TimeoutPolicy. The property is used for internal JDBC queries only.