Skip to content

thomasgauvin: update docs for cache status volatile, stable functions#28536

Merged
thomasgauvin merged 7 commits intoproductionfrom
thomasgauvin-hyperdrive-volatile-stable-functions-cache-clarification
Feb 26, 2026
Merged

thomasgauvin: update docs for cache status volatile, stable functions#28536
thomasgauvin merged 7 commits intoproductionfrom
thomasgauvin-hyperdrive-volatile-stable-functions-cache-clarification

Conversation

@thomasgauvin
Copy link
Contributor

No description provided.

@thomasgauvin thomasgauvin requested review from a team, Oxyjun, elithrar and sejoker as code owners February 23, 2026 20:01
@github-actions github-actions bot added product:hyperdrive Hyperdrive: https://developers.cloudflare.com/hyperdrive/ product:changelog size/m labels Feb 23, 2026
@github-actions
Copy link
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/changelog/ @cloudflare/pm-changelogs, @cloudflare/pcx-technical-writing
/src/content/docs/hyperdrive/ @elithrar, @thomasgauvin, @sejoker, @oxyjun, @cloudflare/pcx-technical-writing

@thomasgauvin
Copy link
Contributor Author

/bonk fix the build issues, review and address any findings

Co-authored-by: thomasgauvin <thomasgauvin@users.noreply.github.com>
@ask-bonk
Copy link
Contributor

ask-bonk bot commented Feb 23, 2026

Summary

Build status: All CI checks pass — npm run check (0 errors), npm run lint (clean), npm run format:core:check (clean).

Fix applied: Updated changelog link text in src/content/changelog/hyperdrive/2026-02-13-hyperdrive-stable-functions-uncacheable.mdx:19 to match target page titles per style guide (changed "query caching" to "Query caching" and "troubleshooting uncacheable queries" to "Troubleshoot and debug").

Review of all 4 changed files:

This is a solid PR that improves Hyperdrive documentation around query caching behavior for STABLE and VOLATILE PostgreSQL functions. Key improvements:

File Assessment
Changelog Well-structured entry with clear explanation of the behavioral change, migration guidance, and documentation links. Good use of "for example" instead of "e.g."
query-caching.mdx Significant improvement — corrected a previously-cacheable CURRENT_DATE() example to use parameterized queries, added a comprehensive function volatility table, added the text-based detection caution, and migrated the bare jsonc config block to WranglerConfig component. Link text in "Next steps" updated to follow style guide.
metrics.mdx Fixed typo ("Hyperdrives's" to "Hyperdrive's"), improved intro phrasing, added helpful explanation of the volatile cache status covering both STABLE and VOLATILE functions.
troubleshooting.mdx Expanded the driver caching section into a proper "Uncached queries" troubleshooting section with three clear causes (function volatility, comment detection, driver config). Also fixed a stray colon in the old prepare: false: link text.

No MDX syntax issues, no unescaped special characters, no broken links, no heading hierarchy violations, no missing imports. Content is technically accurate and well-written.

github run

description: Hyperdrive marks queries containing STABLE PostgreSQL functions as uncacheable, preventing stale cached results.
products:
- hyperdrive
date: 2026-02-13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note - needs new date - also for file name

date: 2026-02-13
---

Hyperdrive treats queries containing PostgreSQL `STABLE` functions as uncacheable, in addition to `VOLATILE` functions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add "now"? - Hyperdrive now treats

@ask-bonk
Copy link
Contributor

ask-bonk bot commented Feb 23, 2026

@Maddy-Cloudflare Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.


Hyperdrive treats queries containing PostgreSQL `STABLE` functions as uncacheable, in addition to `VOLATILE` functions.

Previously, only functions that PostgreSQL categorizes as `VOLATILE` (for example, `RANDOM()`, `LASTVAL()`) were detected as uncacheable. `STABLE` functions (for example, `NOW()`, `CURRENT_TIMESTAMP`, `CURRENT_DATE`) were incorrectly allowed to be cached.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth linking to this? - https://www.postgresql.org/docs/current/xfunc-volatility.html

Or something like it?

@@ -0,0 +1,19 @@
---
title: Queries using STABLE PostgreSQL functions are no longer cached
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd name Hyperdrive in the title since the changelog is global

@mikenomitch
Copy link
Contributor

/bonk address the issues in comments

Co-authored-by: mikenomitch <mikenomitch@users.noreply.github.com>
@ask-bonk
Copy link
Contributor

ask-bonk bot commented Feb 23, 2026

All checks pass. Here's a summary of the changes made to address all four review comments:

Review Comment Change
Name Hyperdrive in title (line 2) Changed title from "Queries using STABLE PostgreSQL functions are no longer cached" to "Hyperdrive no longer caches queries using STABLE PostgreSQL functions"
Update date (line 6 + filename) Updated date from 2026-02-13 to 2026-02-23 and renamed file accordingly
Add "now" (line 9) Changed "Hyperdrive treats" to "Hyperdrive now treats"
Link to PostgreSQL volatility docs (line 11) Added link on VOLATILE to https://www.postgresql.org/docs/current/xfunc-volatility.html

github run


Hyperdrive now treats queries containing PostgreSQL `STABLE` functions as uncacheable, in addition to `VOLATILE` functions.

Previously, only functions that PostgreSQL categorizes as [`VOLATILE`](https://www.postgresql.org/docs/current/xfunc-volatility.html) (for example, `RANDOM()`, `LASTVAL()`) were detected as uncacheable. `STABLE` functions (for example, `NOW()`, `CURRENT_TIMESTAMP`, `CURRENT_DATE`) were incorrectly allowed to be cached.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/bonk change the link to be on "that PostgreSQL categorizes" instead of on VOLATILE

Co-authored-by: mikenomitch <mikenomitch@users.noreply.github.com>
@ask-bonk
Copy link
Contributor

ask-bonk bot commented Feb 23, 2026

The link has been moved from `VOLATILE` to "that PostgreSQL categorizes" on line 11. This reads more naturally since the link target is about PostgreSQL's function volatility categorization system, not specifically about the VOLATILE keyword.

github run

**Stable or volatile PostgreSQL functions in your query**: Queries that contain PostgreSQL functions categorized as `STABLE` or `VOLATILE` are not cacheable. Common examples include `NOW()`, `CURRENT_TIMESTAMP`, `CURRENT_DATE`, `RANDOM()`, and `LASTVAL()`. To resolve this, move the function call to your application code and pass the result as a query parameter. For example, instead of `WHERE created_at > NOW()`, compute the timestamp in your Worker and pass it as a parameter: `WHERE created_at > $1`. Refer to [Query caching](/hyperdrive/concepts/query-caching/) for a full list of uncacheable functions.

If your queries are not getting cached despite Hyperdrive having caching enabled, your driver may be configured such that your queries are not cacheable by Hyperdrive. This may happen if you are using the [Postgres.js](https://github.com/porsager/postgres) driver with [`prepare: false:`](https://github.com/porsager/postgres?tab=readme-ov-file#prepared-statements). To resolve this, enable prepared statements with `prepare: true`.
**Function names in SQL comments**: Hyperdrive uses text-based pattern matching to detect uncacheable functions. References to function names like `NOW()` in SQL comments cause the query to be treated as uncacheable, even if the function is not actually called. Remove any references to uncacheable function names from your query text, including comments.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Function names in SQL comments**: Hyperdrive uses text-based pattern matching to detect uncacheable functions. References to function names like `NOW()` in SQL comments cause the query to be treated as uncacheable, even if the function is not actually called. Remove any references to uncacheable function names from your query text, including comments.
- **Function names in SQL comments**: Hyperdrive uses text-based pattern matching to detect uncacheable functions. References to function names like `NOW()` in SQL comments cause the query to be treated as uncacheable, even if the function is not actually called. Remove any references to uncacheable function names from your query text, including comments.

thomasgauvin and others added 2 commits February 24, 2026 10:21
Co-authored-by: Maddy <130055405+Maddy-Cloudflare@users.noreply.github.com>
Co-authored-by: Maddy <130055405+Maddy-Cloudflare@users.noreply.github.com>
@thomasgauvin thomasgauvin merged commit d8e2831 into production Feb 26, 2026
9 checks passed
@thomasgauvin thomasgauvin deleted the thomasgauvin-hyperdrive-volatile-stable-functions-cache-clarification branch February 26, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:changelog product:hyperdrive Hyperdrive: https://developers.cloudflare.com/hyperdrive/ size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants