Performance hints
Performance hints provide actionable steps for improving an FQL query’s performance. You typically use performance hints when testing or prototyping queries in the Fauna Dashboard Shell.
Enable performance hints
Performance hints are disabled by default. To enable hints in the Dashboard Shell, toggle Performance Hints .
Example
As an example, Fauna emits performance hints for uncovered index queries. The following FQL query uses an index but projects fields that aren’t covered by the index definition:
// This is an uncovered query.
// `stock` is not one of the terms or values
// in the `sortedByPriceLowToHigh()` index definition.
Product.sortedByPriceLowToHigh() {
name,
stock
}
In the Dashboard Shell, the result includes a performance hint, if enabled:
performance_hint: non_covered_document_read - .stock is not covered by the Product.sortedByPriceLowToHigh index. See https://docs.fauna.com/performance_hint/non_covered_document_read.
at *query*:6:3
|
6 | stock
| ^^^^^
|
{
data: [
...
]
}
Performance hint codes
Each performance hint includes a leading code that indicates its type.
The following table provides a description of each hint type, along with examples and resolutions to address the hint.
Hint code | Description | Examples and resolutions |
---|---|---|
The query calls
To address the hint, use an index
with a |
||
Returned for uncovered index queries. The query uses an index but returns entire documents or field values not covered by the index. Consider adding the uncovered fields to the index definition’s
Fauna does not return the
|
||
The query calls an eager-loading method on a document Set. To address the hint, do one of the following:
Alternatively, the query calls
|
X-Performance-Hints
header
Internally, performance hints are enabled and disabled using the
X-Performance-Hints
request header for the Core HTTP API’s
Query endpoint.
Performance hints are returned in the response’s summary
. For more
information, see Query
summary.
Performance hints in client drivers
To reduce resource consumption, Fauna’s client drivers disable performance hints by default.
To enable use in the Dashboard Shell, the Fauna JavaScript driver includes a configuration option for performance hints. See the JavaScript driver API reference.
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!