Is there any way to speed up the time a query takes?

// 20 characters necessary

There isn’t any one-size-fits-all guidance to make here: not all queries are the same.

Read-only queries should almost always respond faster than queries that involve writes, because writes need a majority of replicas to acknowledge the write commitments. Fauna replicas are in multiple regions, so the speed of light imparts a minimum that cannot be reduced.

There are tradeoffs that you might make if you want to optimize individual query performance vs workflow performance. You could attempt to perform fewer function calls in queries, but that might require you to execute additional queries.

If you make use of a large number of Roles, know that Role predicates have to be executed for every query involving matches on the membership or privileged resource.

Beyond this generic advice, an analysis of your current queries and query times would be required to offer any specific advice.

1 Like