StarlordS
Convex Community13mo ago
73 replies
Starlord

Suboptimal Caching Behavior for Public Queries

Current Behavior

- Query results are only cached per user session
- Cache is not shared between different users or sessions
- Even public queries with stable parameters require fresh DB hits for each new user/session
- Example: Product listing queries with same filters/pagination hit DB for each new visitor

Expected Behavior

- Public queries with identical parameters should be cached across users/sessions
- Queries that don't depend on user-specific data (like ctx.auth.getUserId()) should leverage shared cache
- Cache invalidation should only occur when underlying data changes

Impact

- Increased database bandwidth consumption
- Higher latency for common queries
- Unnecessary load on database for identical queries
- Cost implications for high-traffic applications
Was this page helpful?