Indexes are a core feature of almost every database today, so it’s no surprise that FaunaDB has them too. FaunaDB is a cloud-hosted, distributed, multi-model database that is well-suited for web and mobile apps.
FaunaDB offers native support for GraphQL, but also provides its own, more powerful query language, FQL, which we’ll use in our indexing examples here.
There are multiple use cases for indexes. The most obvious is improved performance when locating specific data within vast collections of records, but pagination, sorting, and searching are also provided by indexes.
Every time we want to satisfy some data requirements that target one or more documents, and we don’t know their refs (the global reference that identifies a unique document within a database), indexes are the way to go.