apps/docs/content/troubleshooting/supabase-grafana-memory-charts.mdx
Here are examples of unhealthy memory usage:
The cache in Postgres is important because the database will store frequently accessed data in it for rapid retrieval. If too much active memory is needed, it runs the risk of excessively displacing cache. This will force queries to check disk, which is slow.
Most data in a database is idle, but in cases where there is little available memory or uncached data is rapidly accessed, thrashing can occur.
Ideally, you want queries to hit the cache 99% of the time. You can use the Supabase CLI inspect db cache hit command to check your cache hit rate. Alternatively, you can run the query found in the CLI's GitHub repo in the SQL Editor
# login to the CLI
npx supabase login
# initlize a local supabase directory
npx supabase init
#link your project
npx supabase link
# find cache hit rate
npx supabase inspect db cache-hit --linked
If the cache hit rate begins to drop below the ideal amount, one should consider taking the following actions:
Optimizing: