Daml Script queyFilter use cases

Thinking of the Daml.Script queryFilter function, I thought that the intent was to provide a mechanism to get a small subset of contracts and avoid loading the non-matching contracts. But, afaiu, the implementation just filters after the entire ACS (of the referred to template) has been fetched. Is that the intent?

1 Like

queryFilter is just a convenience wrapper. As you noticed it provides no performance benefit. On the gRPC API the ledger doesn’t provide any payload filtering anyway so there is no way we could fetch less data. On the JSON API we do have filtering but fairly limited one. There is no way we could map an arbitrary function a -> Bool to a JSON API filter, the API would need to be a lot more restrictive.

2 Likes

Thank you.