Can anyone give at least 5 detailed examples of queries of TRO and TCO because I’m worried about for what queries I’m going to be billed for and can understand when do I need or not each type of query in my coding.
What do you mean by “each type” of query?
A “TRO” query and a “TCO” query? I don’t know if it’s appropriate to describe queries as simply one or the other. You could easily construct a query that costs a bunch of both, or maybe a little of both.
The docs billing page would be the best description of what operations incur Transactional Read Ops and Transactional Compute ops. But that doesn’t necessarily give you an instinct of what a query will cost.
Compute ops are actually one of the easiest things to predict. Every 50 function call = 1 TCO. That’s it! This can be tested in the web shell.
Map( // 1 function call [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10 11,12,13,14,15,16,17,18,19,20 21,22,23,24,25], Lambda( // 0 calls? I think Lambda is transparent 'n', Add(Var('n'), 100) // 2 function calls per mapped item ) ) // 1 + 25 * 2 = 51 = 2 TCOs
This example shows that if you
Map over a Page of results to
Get the Documents, for example, it will take 1 TCO for every 25 Documents.
There’s a bunch of rules that the docs specify for reads. I won’t repeat the docs, but here’s some things that might help.
Remember that the “x-byte-read-ops” is the “Transactional Read Ops”. It’s there in the docs, but I was confused for a while, myself so don’t make the same mistake! This can be seen in the shell, or observe the headers in your favorite driver. It helps now that “readOps” no longer shows up along with “byteReadOps”
8when the index has no
1in all other cases.
Different Set operations cost different amounts, base on how much they have to read its arguments.
Union should be about 1 TRO per Set argument.
Intersection works out closer to 2 * [# of Set arguments].
If you build queries that uses
Difference, etc. or especially various combinations of them, I recomend need to experiment. If there are multiple indexes used, each index might cost different amounts depending on the size or the partitions, and that all adds up in different ways.