jonahJ
Convex Community2mo ago
9 replies
jonah

Optimizing queries for caching and index use

Advice
i just deployed my first convex app to production, but have been running into issues where queries aren't being cached (even though it seems like nothing is changing?). the queries themselves are also super expensive, since they're doing aggregations over ~20k documents each time.

i've done a few iterations now trying to improve these, but i still haven't determined what the cause is for my queries busting the cache.

the source code for the app is here - it's a pretty standard convex + react app https://github.com/jonahsnider/scores.frc.sh
the tl;dr is that this uses a public API to fetch the schedules & scores from robotics competitions and then calculates the highest scores. a cron job fetches updated event metadata & match results every 5 minutes, which seems to be the most likely suspect of what's causing the cache to get busted.

i'd be greatly appreciative if someone with more convex experience could take a look at some of the queries & mutations and help me understand what i can do to improve this. i'm happy to answer any questions you may have, help set the project up locally, etc. thank you!!
49827.png
33270.png
Was this page helpful?