FaunaDB is a cloud-native OLTP database with distributed ACID transactions using the Calvin protocol. It includes support for enterprise features like configurable data retention and hierarchal multi-tenancy. FaunaDB is available as a managed cloud service or as a downloadable JAR, machine image, or container.
Fauna was founded in 2012 by a team of ex-Twitter engineers to solve consistency vs scale tradeoff in distributed data infrastructure. FaunaDB in inspired by Calvin, and is the only commercial database system that implements that protocol till date.
FaunaDB’s distributed transaction log is processed deterministically and non-conflicting transactions are retired to multi-version concurrency control storage (MVCC) with configurable data retention. Queries can access the previous versions of documents and indexes by supplying a timestamp, and even compare subqueries between snapshots at different timestamps. With elevated privileges, queries can modify past snapshots, because sometimes it’s better to fix a mistake than issue compensating transactions.
FaunaDB is an indexed document store that allows access to the stored data using multiple models - relational, document, graph and key-value. Data stored using one paradigm can be queried with the others, for instance, GraphQL queries can read data written by FQL, etc.
FQL supports references between documents with the Ref() type. Refs can be followed by queries to load related documents, or used in index lookups and results.
FaunaDB indexes are accessed via term and paginated by value, enabling developers to optimize data locality as applications scale. Queries can use joins and other set operations to combine indexes, as well as iterate over rows to load documents or run dependent queries. By default, indexes work with snapshot isolation, but they can be configured for serialized isolation.
Read-write transactions using serialized indexes run with strict-serializability. Read-only transactions and index reads from non-serialized indexes will see snapshot isolation. Clients can upgrade to strict-serializability across all operations.
FaunaDB supports equi-joins and other relational algebra operations like union, intersect, minus, etc. across classes. Support for outer joins is on the roadmap.
FaunaDB uses standard file-based query logging with configurable log file locations. Additionally a
statsd interface is provided for integration with tools like Datadog and Graphite.
Fauna Query Language (FQL) is expression oriented: all functions, control structures, and literals return values. It is easy to map over a collection and compute a result, possibly fetching more data, for each member. Queries are executed as ACID transactions by submitting them to any node in the FaunaDB cluster, which acts as the coordinator for the query. FaunaDB also offers support for GraphQL, including schema import. FQL allows access to historical snapshots, and makes it easy to compare the results of the same query at different times.
Storage is automatically partitioned across a FaunaDB cluster, with each replica containing one full copy of the data set. Multi-version concurrency control enables configurable data-retention and ensures queries see a consistent snapshot of the database.
FaunaDB's FQL allows user-defined functions, which can be called from other queries, and are subject to FaunaDB's access control rules.
All nodes in a FaunaDB cluster run the same Java JAR, with administrator control over log and data replication topology. Queries can be serviced by any node in the cluster, which acts as the coordinator for the query. Queries run as isolated ACID transactions, and can include precondition checks and dependent queries. Transactions are processed using the Calvin protocol which is optimized for multi-region deployments.
FaunaDB’s indexes are similar to views, in that they materialize covered fields from the source class, which are returned as part of the index query result. Similar to materialized views, access control rules can enforce that particular indexes can only be read by client keys with specific roles. View entries can be sorted by value for efficient pagination, or bucketed by term for scalable O(1) lookups.