Hello,
I am building a SaaS product for which FaunaDB seems quite a good fit. However, it is extremely important for me at the moment to make sure that I understand the operation count for indexes in details, before I can proceed. I find that the documentation about indexes gives a bit too much room for interpretation, but combining it with some playing around, I arrived to the following conclusions, which I would like to have confirmed or corrected, and some questions.
For simplicity, let’s make the following two assumptions:
- all indexes I use have a non empty list of terms
- all indexes I use have exactly 2 values, one of which is the id of the document Ref
Read operations
Since the terms list is not empty, every read only needs to look into one partition. Therefore, for each index one readops is count for each 4kB read from the index. However, such read operations don’t group up, so if I read 100B from 40 indexes, I make 40 readops. Is this correct?
Also, I would like to know if and how the terms have an influence on the number of readops per index. My guess so far would be that the total terms list size is accounted once per index read, while the values are of course counted for each results provided by the match index operation. So for example if there are 50 results, then I should (roughly) account for a total readBytes of 50x(avg. values size)+terms size in the match index query. Is this correct? Or do terms have an bigger impact?
Write operations
For each create/update/delete of a document from a collection, only the indexes with matching terms are updated. So the other indexes do not occur in write operations. Is this correct?
Suppose now that we are updating a document. Since the id is not going to change, under the above assumptions, for each index we have exactly one field in the index that can possibly change. My question is, are the fields that stay the same also rewritten (in the index result) and account for bytesWrite or only the one which change?
Also, according to the documentation the index writes groups. So if I write update the document with 100B, and there are from 20 indexes which get updated by 45B data each, then this counts in total for 1 readOp.
Compute Operations
Compute operations (after the first one per query) are only counted when the Index is created and the total amount depend on the preexisting documents in the collection. Correct?