All Topics
All Topics
Technology
Technology
AI
AI
Business
Business
Entertainment
Entertainment
News
News
Programming
Programming
Security
Security
Science
Science
Design
Design
Environment
Environment
Finance
Finance
Crypto
Crypto
Politics
Politics
Sports
Sports
Education
Education
Gaming
Gaming
Art
Art
Music
Music
Health
Health
Books
Books
Food
Food
Travel
Travel
Personal
Personal
Bluesky
Twitter

Hyperdrive - Hyperdrive no longer caches queries using STABLE PostgreSQL functions

4mo ago

Source

CloudflareHyperdrive - Hyperdrive no longer caches queries using STABLE PostgreSQL functionscloudflare.com
Snippet from the RSS feed
Hyperdrive now 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. Because STABLE functions can return different results across different SQL statements within the same transaction, caching their results could serve stale or incorrect data. This change aligns Hyperdrive's caching behavior with PostgreSQL's function volatility semantics. If your queries use STABLE functions, and you were relying on them being cached, 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 WHERE created_at > $1 . Hyperdrive uses text-based pattern matching to detect uncacheable functions. References to function names like NOW() in SQL comments also cause the query to be marked as uncacheable. For more information, refer to Query caching and Troubleshoot and debug .

You might also wanna read

Comments

Sign in to join the conversation.

No comments yet. Be the first.