Boosting Graph Query Performance with Cached Templates
To optimize query performance, Cached Templates pre-process and caches translated queries as templates. The initial execution of a query generates a template with placeholders for variable values. This eliminates the need for repeated translation when the same query structure is used with different variables, resulting in substantial performance improvements.
Cached Templates can be activated by adding the stored=true
query string parameter and the cg-stored-query: template
header to your requests. The service will handle template generation and caching automatically, improving the efficiency of subsequent requests. This feature will be enabled for all requests automatically later this year.
The system supports the following variable types for cached templates: Boolean, Date, DateTime, String, Int, Float, Locales, and [Locales]. For Locales and [Locales] types, the variable name is required to be 'locale'. Any other variable types will result in a fallback to 'Cached Queries'.
Cached Queries, similar to Cached Templates, improve performance by caching fully resolved queries. They act as a backup for queries incompatible with Cached Templates.
These features are a major step towards optimized Graph query performance, ensuring faster applications and a better user experience.
Comments