Billing

Fauna billing is primarily based on the resources that you use in your queries. Fauna provides a generous free tier so that you can learn how the service works. You can also choose to purchase higher tiers with predictable pricing or support. See the pricing page for more information.

This section describes how resource usage is counted.

Terminology

Document

A JSON object stored in a Fauna database, which includes user-provided documents and Fauna schema documents, such as those describing databases, collections, indexes, keys, user-defined functions, and roles.

Query

An expression of one or more FQL functions intended to achieve or return a result. Queries are executed as an all-or-nothing transaction by Fauna.

Transactional Read Operation (TRO)

Fauna read operations. Fauna ensures strong consistency of all read transactions through strictly serializability based on their position in a global transaction log because the order reflects the real-time processing order. Read-only transactions are serializable with an added consistent-prefix Read Your Own Writes (RYOW) guarantee. See the Fauna ACID compliance documentation.

Transactional Write Operation (TWO)

Fauna write operations. Like TROs, Fauna provides strict serializability for write operations, which is recognized as the ideal consistency model.

Transactional Compute Operation (TCO)

Fauna compute operations. In addition to storage-related operations, compute operations are required to manipulate data and include user-defined functions.

Metering details summary

Usage is billed based on the resources consumed by your API queries. A query results in a read, write, compute, storage, and other operations, depending on the shape of your query.

See Query log for information about how to get visibility into the billable events related to your API queries.

Usage type Billing units Metering details

API calls to read data from your database are billed in TROs.

A read request, by default strongly consistent and transactional, of up to 4 KB requires one TRO. For items larger than 4 KB, more TROs are required. For example, a read request of an 8 KB item requires two TROs. Note also that the size is rounded up in the calculation. For example, reading 1.1 KB costs two TRO.

API calls to write data to your database are billed in TWOs.

A write request, by default transactional and replicated, of up to 1 KB requires one TWO. For items larger than 1 KB, more TWOs are required. For example, a write request of a 3 KB item requires three TWOs. Note also that the size is rounded up in the calculation. For example, writing 1.1 KB costs two TWOs.

API calls to your database incur CPU usage that, which is billed in TCOs.

An API call with up to 50 function calls requires one TCO.

Data written to your database is billed in terms of disk space used and is called Data Storage.

Storage is measured in GB and includes the total volume of data stored on disk for each write, including storage incurred for temporality. The amount of space occupied is charged monthly.

Compute units, TCOs, needed to create backup snapshots.

For example, if you back up a 1 GB database, the cost is 1000 MB * 100 TCOs, which is 100,000 TCOs for the snapshot plus the base charge of 20,000 TCOs, for a total of 120,000 TCOs.

Snapshot storage is billed based on size, in GB, and retention period, in days, and is called Backup Storage.

For every 1 MB of data stored per day, you are billed $.00005 in the US Region Group. For example, if you have 1 GB of backup snapshots stored for 30 days, that is 1000 MB * 30 * $.00005, which is $1.5.

Compute units, TCOs, needed to restore or copy from a snapshot.

For every 1 MB of data restored or copied, you incur 100 TCOs on your bill. For example, restoring or copying a 1 GB database is 1000 MB * 100, which is 100,000 TCOs. The cost of TCOs you incur depends on the Region Group of your database. The US Region Group costs $2.05 per million TCOs. So, for 100,00 TCOs, you are charged $.205 per restore or copy.

Log requests incur CPU usage, which is billed in TCOs.

Each log request is translated to TCOs based on the number of log lines received. Logs are billed in two tiers:

  • Requests that yield less than or equal to 100k lines cost 49,500 TCOs per request.

  • Requests that yield more than 100k lines cost 0.495 TCOs per line.

Metering unit rates summary

The following usage unit rates apply for the different geographic regions. See Region Groups for more information about Region Groups.

Billing units US Region Group EU Region Group Global Region Group

Transactional Read Ops (TROs)

$0.46/million

$0.55/million

$0.69/million

Transactional Write Ops (TWOs)

$2.28/million

$2.73/million

$3.42/million

Transactional Compute Ops (TCOs)

$2.05/million

$2.46/million

$3.08/million

Data Storage

$1.00/GB/month

$1.20/GB/month

$1.50/GB/month

Data Transfer
(See Data Transfer, egress)

$0.20/GB/month

$0.20/GB/month

$0.20/GB/month

Backup storage

$0.05/GB/day

$0.05/GB/day

$0.05/GB/day

Query log (TCOs)

$2.05/million

$2.46/million

$3.08/million

Rates for the Global Region Group are 1.5 times the US Region Group rates.

Data Transfer, egress

Free / PAYG Startup Pro / Free Trial Enterprise Virtual Private Fauna

2 GB included then 0.2/GB

10 GB included then 0.2/GB

50 GB included then 0.2/GB

100 GB included then 0.2/GB

100 GB included then 0.2/GB

Usage billing details

The following resources and operations are counted for billing purposes.

Read requests

FQL reports only byte read ops, which means that the number of bytes read in the query are aggregated and rolled up into the read_ops stats it reports.

The following functions incur TROs:

AccessProvider

AccessProvider.byName()
AccessProvider.firstWhere()

Collection

Collection.byName()
Collection.firstWhere()

Credential

Credential.byDocument()
Credential.firstWhere()
exists()
login()
verify()

Database

Database.byName()
Database.firstWhere()

Document

exists()

Function

Function.byName()
Function.firstWhere()

Key

Key.firstWhere()
exists()

Role

Role.byName()
Role.firstWhere()

Set

Set.paginate()
aggregate()
any()
count()
every()
first()
firstWhere()
fold()
foldRight()
forEach()
includes()
isEmpty()
last()
lastWhere()
nonEmpty()
paginate()
reduce()
reduceRight()
toArray()

Token

Token.byDocument()
Token.firstWhere()

Sets materialize when returned by a query, which is semantically equivalent to adding a .paginate() call to it. Therefore, queries returning sets, as in the following example, incur read ops even though they didn’t call for any of the preceding set functions.

Foo.all().map(.name)

Similarly, documents are lazily materialized as needed so, although Foo.byId(123) doesn’t read bytes instantly, projecting a field out of it requires a read and, therefore, incurs read ops. For example:

let doc = Foo.byId(1234)  // no reads so far
doc.bar                   // reads the doc

Some functions don’t incur read ops if their results aren’t used. For example:

let set = Foo.all().reverse()  // No reads done for the set
Foo.byId(123)                  // Reads done for the document

This query reports fewer read-ops than the following query:

let page = Foo.all().reverse().paginate(10) // Reads done for the set
Foo.byId(123)                               // Reads done for th

One TRO is counted when up to 4 KB of a document is read from storage. A 20 KB document requires five TROs and a 4.1 KB document requires two TROs.

One TRO is counted when up to 4 KB of tuples is fetched from an index.

Also, one TRO per index partition is counted. An index with no terms defined has eight partitions, so seven more TROs are counted beyond the number required to read a page from the index.

One TRO is counted when up to 4 KB of document history is read from storage. A 0.5 KB document with more than 32 KB of historical versions requires eight TROs.

TROs for authentication or identity checks are counted according to the size of the token or key. One TRO is counted when up to 4 KB is read.

TROs are counted whether the query fails or not.

If a query has to be retried because of conflicts with other concurrent queries that are writing to the same documents, the query is retried and incurs TROs again.

Write requests

FQL only reports byte write ops, which means all bytes written during the query are rolled up into its write_ops stats reported.

The following functions incur TWOs:

AccessProvider

AccessProvider.create()

Collection

Collection.create()

Credential

Credential.create()
delete()
login()
replace()
update()

Database

Database.create()

Document

delete()
replace()
update()

Function

Function.create()

Key

Key.create()
delete()
replace()
update()

Role

Role.create()

Token

Token.create()
delete()
replace()
update()

One TWO is counted when up to 1 KB of a document is written to storage. A 20 KB document requires 20 TWOs and a 1.1 KB document requires two TWOs.

Index writes, for documents that are created, updated, or deleted, incur TWOs: one TWO is counted when up to 1k of index data is written, even when those writes span multiple indexes.

Writing an index entry involves modifying four locations in index storage and includes the field values in the terms and values definitions plus the Reference and timestamp (ts) from the covered document.

Indexes created after their source documents must backfill their entries, which is a process that is handled by a background job, except when the number of documents is less than 128. For background job processing, associated read, write, and compute charges are included. You can’t query the index until the backfill is completed.

Adding constraints requires indexes in the background. Those indexes have a write cost associated with creating a terms index on the unique fields.

TWOs aren’t typically counted for queries that fail. The exception is contended transactions that fail with a 409 status code, for which TWOs are counted.

See the x-byte-write-ops response header in the Per query metrics section.

The fauna-shell import command incurs TWOs.

Compute

TCOs include user-defined functions (UDFs) and API calls.

Every function call, operator call, and field projection incurs one fiftieth of a TCO. The Set.toArray() method, for example, costs one TCO for every 50 items in the Set:

let doc = Foo.byId(1234) // 1 compute op
doc.bar                  // 1 compute op
2 + 2                    // 1 compute op
doc.bar + 2              // 2 compute ops
Foo.all().toArray        // N compute ops

During index writes, TCOs are incurred because an anonymous function is called to project each term and value covered.

User-defined functions might call many functions with each invocation. All function calls are counted. TCOs might grow rapidly when using functions such as map() and reduce(), or when calling a UDF recursively.

The import command in fauna-shell performs TCOs.

See the x-compute-ops response header in the Per query metrics section.

Storage

Documents are stored on disk, and the amount of space occupied is charged monthly.

Indexes are also stored on disk and contribute to the storage that is charged monthly. The size of indexes varies with the size of the data that is indexed.

Adding constraints requires indexes in the background. Those indexes have a storage cost associated with creating a terms index on the unique fields.

Storage reporting is a continuous process where the storage occupied by each database is determined daily. The billed amount for storage is determined by taking an average of the daily storage reports in a calendar month.

There can be some inaccuracy in storage reporting because of server topology changes. When this occurs, the reported storage is less than the actual, resulting in lower billing.

Be aware that all revisions to a document are stored as separate images. Each document update contributes to the storage total. Deleting unused documents and their revisions reduces required storage. Setting the document ttl field, or the collection history_days or ttl_days fields, can indirectly reduce storage.

For more information, see Temporality.

Snapshots

See the pricing page for current snapshot rates.

Snapshots for backups incur charges in three ways:

Operation Charge description

Creation

The number of TCOs required to produce a snapshot. One hundred TCOs are charged per megabyte of data captured in the snapshot, with a base of 20,000 compute operations.

For example, for a 1-gigabyte database, the total TCOs required are 100 TCOs per megabyte × 1,000 MB + 20,000 TCOs = 120,000 TCOs.

Pricing for TCOs varies by Region Group. If the cost for TCOs is $2.05/million, you are charged $0.24 USD for a 1-gigabyte snapshot in the US Region Group.

Retention

The number of gigabytes required to store cumulative snapshots.

For example, the storage occupied for 30 days of 10 MB snapshots is 0.3 GiB, 30 days × 0.01 GiB.

Pricing for storage varies by Region Group. If the cost of storage is $0.05 USD per gigabyte per day, you are charged $0.02 USD to store 30 days of snapshots at 10 MB each in the EU Region Group.

Snapshots exist at the account level and are retained even if the original database is deleted or backups for a database are turned off. This is convenient when you want to recover a database that you inadvertently deleted.

Restore/copy

The number of TCOs required to restore or copy a snapshot. One hundred TCOs are charged per megabyte of data restored/copied from a snapshot.

For example, for a 1-gigabyte snapshot, the total TCOs to restore/copy the snapshot are 100 TCOs × 1,000 MB = 100,000 TCOs.

Pricing for TCOs varies by Region Group.

Dashboard usage

Using the Fauna Dashboard to navigate your databases, collections, indexes, functions, keys, and tokens, plus running FQL queries, consumes read, write, and TCOs. The Dashboard uses the same queries you might use to fetch the information.

The Dashboard tries to display the latest information available, so every time you navigate to a new display or refresh your browser, more queries are executed to populate the display.

Browsing your databases using the Dashboard incurs only a small fee. To incur $0.01 USD on your bill, you must consume more than 20,000 TROs or more than 4,000 TWOs. If your monthly usage is lower than your plan limits, Dashboard use does not incur extra cost.

Here are some guidelines for Dashboard usage:

Activity Expected read ops

Every time you visit the Home page

48

Every time you visit a database Overview page

32
+ <# of collections>
+ <# of indexes>

Every time you visit the Collection details page

8
+ <# of documents>

Every time you click the Collections button (in the left navigation pane)

8
+ <# of Collections>
plus the cost of loading the first Collection details.

Functions, indexes, keys, access providers, and roles are represented by documents, so browsing the other pages also incurs costs.

Varies

Per query metrics

Fauna query metrics are reported in the JSON response stats field. You can use this information to accurately calculate the resource cost of running your queries, especially if your applications execute them frequently.

Exceeding limits

If you are using the Free plan and exceed the stated limits listed on the pricing page in a calendar month, the following actions take place:

  1. An email notification is sent to the email address associated with your account, advising you of the situation.

  2. If you continue to use the service without upgrading to a paid plan, the keys per tokens that you use to access the service (from client applications) are temporarily revoked.

    The Dashboard no longer lists databases that exist in your account. No data is lost or removed.

    The period between notification and revocation varies but is about one week.

  3. If your access to databases is temporarily revoked, you can upgrade to a paid plan to have your keys per tokens reinstated. Reinstatement is a manual process, so your databases continue to look unavailable after upgrade.

    Reinstating access for temporarily revoked keys per tokens requires that you contact support@fauna.com even if you have upgraded to a paid plan.

The metrics for paid plan account limits are reset on the first day of a calendar month. Accounts with revoked access have their access reinstated on the last day of a calendar month.

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!