Dashboard Read Operations

Hey, new to Fauna!
What are the differences between the two Read Ops on the Dashboard? One says 56 Read Ops and one says 2077 Read Ops. Which one is used for billing?
Thanks.

Related: What are some examples of what equals 1 read operation?

My read ops count seems to increase at a multiple faster than the # of queries I send to Fauna, so I’d like to better understand how constitutes a read op when using FQL or GraphQL.

For example, how many read ops is this “SELECT … WHERE”? More than one?

    let index = 'some_index'
    let val = 'foo'
    let res = await client.query(
      q.Map(
        q.Paginate(q.Match(q.Index(index), val)),
        q.Lambda('val', q.Get(q.Var('val')))
      )
    );

Hey, this will let you know how many operations you are using by attaching an observer function to all your queries.

https://forums.fauna.com/t/view-costs-with-faunadb-js/483

I also found the billing section in the docs useful.

1 Like

Thank you!

For others: the observer function prints headers containing this:

'x-read-ops': '2',
'x-write-ops': '0'
...

It appears my SELECT...WHERE query uses 2 read ops because it has to Get the document id, before it can fetch the docs with Paginate.

Update: I figured out how to get a single doc in 1 read op (similar to a SELECT ... WHERE foo=val LIMIT 1:

client.query(q.Get(q.Match(q.Index(index), val)))

No problem, I have found those operation numbers to be aligned with the smaller number of operations on my dashboard but I have no idea where the bigger number (2077) of operations is coming from.

It looks like 56 is today and 2,077 is the week total.

I don’t think that’s the case. Both are reading from the last 7 Days. If you look at the bottom graph on a per day basis you will see the read operations are a lot higher than 56.

Something seems off. I didn’t notice the pie chart said 7 days too.

Adding up the dark blue bars of the lower chart totals ~2,077. That’s where that total comes from.

But the pie chart looks incorrect (may showing 1 day?) or the bar chart is overcounting. Or both lol

Do you feel like the Bar Chart is accurately displaying the amount of operations you use? You mentioned it was higher than you thought.

The bar chart’s read ops are higher than I expected for my usage, but I’m still getting a feel for how many ops certain queries will consume. I’m too new to Fauna to know if it feels accurate yet.

1 Like

I did an inquiry to see whether the labeling is wrong or whether the query is wrong ;). I’ll try to get your answer as soon as possible.

Yes, an index Match counts as one read op and a Get is a read op. Actually, more accurate is that one index page counts as one read op since Paginate will return pages. If you only fetch the first page (regardless of how big that page is), you only pay one read operation.

If you however Map over that page and Get let’s say the page is of size N then the read operations is going to be N (gets) + 1 (index match).

The interesting thing to note here is that Map/Get is very flexible. When you add attributes to your data, they will automatically appear in the result of your query. On the other hand, you can specify values in your index and one of the functions of values (among others) is to serve as return values. Since an index page equals one read operation, this can be used as a means to lower the cost once you are more or less certain that your data won’t change too often (since that would require you to recreate the index to add/remove a value).

https://docs.fauna.com/fauna/current/concepts/billing.html is indeed the best page of reference to determine how a specific FQL function impacts the pricing of your query.

For people who didn’t know this, the observer function is a workaround since the JavaScript driver does not expose these headers by default. If you are just testing in the FaunaDB UI dashboard shell, you can also look into your Chrome dev tools to see the operations of a query.

1 Like

There is indeed something off with the dashboard UI. There is an open ticket to fix it.

Roger that. Thanks for the help!

Hello, I just wanted to chime in on the dashboard usage numbers to confirm that this is indeed solely a bug in the dashboard reporting on this home page, and that the usage numbers on your invoice are still accurate.

Essentially, what’s happening in this bug in the dashboard Home page charts is that the usage data is being “scoped” to a key now, meaning these rollups no longer include usage from child database keys. If all of your API calls are from child db keys, the usage you see here will only reflect your usage from dashboard operations in the parent/top-level database, like queries you run from the playground and webshell.

As Brecht said, we do have a high priority ticket in to fix this. Meanwhile, if anyone has any additional questions about this, and/or the usage reported on your invoice, please feel free to email product@fauna.com so that we can clear it up :slight_smile:

1 Like