Billing
Fauna billing is primarily based on the resources that you use in your queries. Fauna provides a generous free tier and you are only billed if you exceed the free tier’s limits. You can also choose to purchase higher tiers that provide predictable pricing, or support. See the pricing page for more information.
This page describes how resource usage is counted.
On November 19, 2020, Fauna, Inc. introduced new billing plans. Users with accounts created prior to this date remain on their existing plans until February 1, 2021, or move to a new plan when they update their billing settings. Users who signup on this date, or later, are automatically assigned to a new billing plan. This page describes the way billing works both before and after the transition date, with "legacy billing" in the left column, and "current billing" in the right column. |
Definitions
- Document
-
A document is any record stored within a Fauna database, which includes user-provided documents and Fauna schema documents, such as those describing databases, collections, indexes, keys, user-defined functions, roles, etc.
- Query
-
An expression of one or more FQL functions intended to achieve, or return, a specific result. Queries are executed as an all-or-nothing transaction by Fauna.
Resources
For billing purposes, use of the following resources is counted:
Write operations
For both legacy and current billing: - The following functions perform writes:
-
CreateAccessProvider
Storage
Storage reporting is a continuous process, where the storage occupied in each database is determined approximately once per week. The billed amount for storage is determined by taking an average of the weekly storage reports in a calendar month.
There can be some inaccuracy in storage reporting due to replica topology changes. When this occurs, the reported storage is less than the actual, resulting in lower billing.
One non-obvious contributor to storage is that Fauna stores all
revisions to a document separately: each update contributes to the
storage total. Deleting unused documents directly reduces required
storage. Setting a document’s ttl
field, or a collection’s
history_days
or ttl_days
fields, can indirectly reduce storage.
Removal is handled by a background task, so once a document (including
collections, databases, indexes, keys, roles, and tokens) "expires" due
to the setting in the As of version 3.0.0, the |
Per query metrics
Fauna FQL queries are performed over HTTP connections, and responses include headers that indicate the resources used in the current query.
For example, for the following FQL query performed with the JavaScript driver:
client.query(
q.Map(
q.Paginate(q.Match(q.Index('all_letters'))),
q.Lambda("X", q.Get(q.Var("X")))
)
)
.then((ret) => console.log(ret))
The following response headers were included with the query result:
{
'alt-svc': 'clear',
'content-length': '4459',
'content-type': 'application/json;charset=utf-8',
date: 'Tue, 17 Nov 2020 22:57:46 GMT',
via: '1.1 google',
'x-byte-read-ops': '34',
'x-byte-write-ops': '0',
'x-compute-ops': '2',
'x-faunadb-build': '20.11.00.rc8-01f9c94',
'x-query-bytes-in': '120',
'x-query-bytes-out': '4459',
'x-query-time': '7',
'x-read-ops': '27',
'x-storage-bytes-read': '3047',
'x-storage-bytes-write': '0',
'x-txn-retries': '0',
'x-txn-time': '1605653866258457',
'x-write-ops': '0'
}
The query reads from a collection containing all 26 letters of the
English alphabet, and it involved a read from the all_letters
index,
which is why x-read-ops
is 27.
You can use this information to accurately determine the resource cost of running your queries, especially if your application(s) execute them frequently.
The Web Shell provides this information as a tooltip for each query
result (hover your pointer over the |
The Fauna GraphQL API does not currently provide per-query billing headers. You would have to correlate your API usage with the reporting available in the Fauna Dashboard. Unfortunately, the reporting there is not real-time, lagging behind query usage by several hours (at least). |
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!