I’m trying to do some performance analysis involving contract query. I’m wondering what’s the time complexity of querying by contract key? The documentation says contract key is similar to database primary key (which I believe is usually hashed index), does that mean queryContractKey has time complexity of O(1)?
In what context are you asking? Daml Script, Triggers, Typescript, etc.?
Generally speaking queryContractKey has order O(log(N)) as it’s an index lookup and database indices are typically b-trees.
More important maybe is that the complexity of queryContractId and queryContractKey are the same.