Memory analyzer

functional

Memory by data type, the biggest keys, and a TTL histogram from a bounded sample.

The Memory Analyzer answers "what is using the memory in this database?" with four reports: memory by data type, memory by key prefix, the largest keys, and how keys are spread across TTL ranges. Right-click a Redis database in the explorer and choose Tools › Memory Analyzer… - it sits beside Disk Usage in the same submenu, which gives the per-database overview this drills into. The same report opens from the Redis Memory Analyzer… command and from a Server Dashboard link beside Disk Usage.

The reports

  • Memory by type - sampled key count and bytes per type (string, hash, list, set, zset, stream…), the share of sampled bytes, and an estimate scaled to the whole database.
  • Memory by prefix - sampled keys and bytes per key namespace (user:, session:…), each prefix's share of the sampled bytes, and both scaled to the whole database. Pick the Depth - 1 groups user:42:profile under user:, 2 under user:42:, 3 one level further, and the delimiters under Split on. They start as the connection's own key delimiters; click a character such as | to split on it too (or click again to stop), which takes a new sample. A key with fewer segments than the depth counts under its deepest prefix, and keys with no delimiter share one row with an empty prefix. Click a column header to sort.
  • Top keys - the 25 largest sampled keys by MEMORY USAGE, with type and TTL.
  • TTL distribution - how many keys have no expiry, expire within an hour, within a day, within a week, or later.
It samples once, and says so. The analyzer walks the keyspace with a bounded SCAN (never KEYS *) of up to 1,000 keys and reads TYPE, TTL and MEMORY USAGE … SAMPLES 5 for each, in batches of 200. All four reports come from that one sample (every prefix depth included, so switching depth is instant), so their counts agree and the server is walked once per refresh. Keys that disappear while the sample is being taken are left out rather than shown as a none type. Columns named sampled_* are measured; estimated_* columns scale the sample linearly to the key count. A line under the reports says how many keys were sampled out of how many, and whether the walk covered the whole database (the figures are exact) or only part of it (the estimates are extrapolated).
SQLly
Redis Memory Analyzer: memory by data type, top keys by MEMORY USAGE, and the TTL distribution, each over a bounded sample.Redis Memory Analyzer: memory by data type, top keys by MEMORY USAGE, and the TTL distribution, each over a bounded sample.
Redis Memory Analyzer: memory by data type, top keys by MEMORY USAGE, and the TTL distribution, each over a bounded sample.

Editing the analysis

The pane's Copy editable script button copies the same commands with a header comment: SQLLY.MEMSUMMARY (the sample summary), SQLLY.MEMBYTYPE, SQLLY.TOPKEYS, SQLLY.TTLBUCKETS and SQLLY.MEMBYPREFIX <sample> <depth> <delimiters> (delimiters as one argument, for example ":|"). Change the sample size (up to 50,000 keys) or the top-keys count and run it in any query tab. Commands in one run that use the same sample size share one sample; each new run takes a fresh one.

When the server cannot measure memory, because it doesn't support MEMORY USAGE or your ACL user isn't allowed to run it (NOPERM), the type and TTL reports still show their key counts. Byte columns stay empty rather than showing zeros, the top-keys list is empty, and the pane says why. Other errors are shown as errors, and any report that finished before the error stays on screen.

If the pane is already open and you pick Memory Analyzer… on a different database or connection, it switches to that database and takes a new sample.

Stop cancels a sample that is still running, the server stops walking at the next page or batch, and the pane keeps the previous sample's reports on screen, saying so in the footer; press Refresh to take a new one.