We are evaluating the scalability of a resource's field that might get big occasionally and would like to confirm how transaction cost is calculated in order to make sure we can continue to execute transactions that interact with that resource (but doesn't access the field that might get big). It seems transaction cost should depend only on the size of the fields that are actually accessed based on the documentation, is that correct?
Asked
Active
Viewed 27 times
1 Answers
4
Accessing composite (struct/resource) fields, dictionary keys, array elements, etc. only loads what is necessary, so e.g. other fields, dictionary keys, and array elements are not loaded.
Transaction cost depends on computation usage. Computation usage for such accesses is not constant, but depends on the size of the accessed value.
This is because these data structures are implemented as trees, which means that the larger the value gets, the deeper the tree gets. On access, more and more non-leaf tree nodes have to be accessed to arrive at the leaf-node.

turbolent
- 288
- 1
- 6