A critical vulnerability was discovered in React Server Components (Next.js). Our Systems Remain Fully Protected. Learn More

Jonas Bergqvist
Feb 27, 2025
  1096
(2 votes)

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.

 

Feb 27, 2025

Comments

Please login to comment.
Latest blogs
Building a 360° Customer Profile With AI: How Opal + Optimizely Unlock Predictive Personalization

Creating truly relevant customer experiences requires more than collecting data—it requires understanding it. Most organizations already have rich...

Sujit Senapati | Dec 4, 2025

Building a Lightweight Optimizely SaaS CMS Solution with 11ty

Modern web development often requires striking a difficult balance between site performance and the flexibility needed by content editors. To addre...

Minesh Shah (Netcel) | Dec 3, 2025

Creating Opal Tools Using The C# SDK

Over the last few months, my colleagues at Netcel and I have partaken in two different challenge events organised by Optimizely and centered around...

Mark Stott | Dec 3, 2025

Introducing the OMVP Strategy Roundtable: Our First Episode Is Live

One of our biggest priorities this year was strengthening the strategic voice within the OMVP community. While the group has always been rich with...

Satata Satez | Dec 1, 2025