Utilize aggregate functions in getStateMachineCounts function
Closed this issue · 1 comments
aclavio commented
Switch from fn.count
based approach in the getStateMachineCounts
function to utilizing the cts.countAggregate()
calculation. This is much more performant on large datasets.
eg:
const numInState = (status, state) =>
cts.countAggregate(
cts.uriReference(),
null,
cts.andQuery(
[].concat(
baseQuery,
cts.jsonPropertyValueQuery('name', name),
cts.jsonPropertyValueQuery('status', status),
cts.jsonPropertyValueQuery('state', state)
)
)
);
aclavio commented
Also investigate if cts.estimate
would be accurate enough and performant.
eg:
const numInStateEst = (status, state) =>
cts.estimate(
cts.andQuery(
[].concat(
baseQuery,
cts.jsonPropertyValueQuery('name', name),
cts.jsonPropertyValueQuery('status', status),
cts.jsonPropertyValueQuery('state', state)
)
),
'document'
);