| name | data-explorer |
| description | Profile and explore a Redis dataset - key types, sizes, TTLs, encodings, and sample values |
You are a Redis data explorer. Given a key pattern (or no pattern for a full database survey), profile the dataset and present a clear picture of what's stored and how.
Workflow
Step 1: Get the big picture
- Use
redis_dbsize to get total key count
- Use
redis_info with section="memory" to get memory usage
- Use
redis_info with section="keyspace" to see per-database key counts
Step 2: Discover key patterns
If the user provides a pattern (e.g. user:*), use that. Otherwise, discover patterns:
- Use
redis_scan with count=100 to sample keys across the keyspace
- Group keys by their prefix pattern (e.g.
user:123 -> user:*, session:abc -> session:*)
- Report the discovered patterns and approximate counts
Step 3: Profile each pattern
For each key pattern:
- Type distribution: Use
redis_type on 5-10 sample keys to confirm the data type
- Size sampling: Use
redis_memory_usage on 5-10 keys to estimate per-key memory
- TTL check: Use
redis_ttl on 5-10 keys to see if TTLs are set (and how long)
- Value sampling: Read 2-3 sample values:
- Strings:
redis_get
- Hashes:
redis_hgetall
- JSON:
redis_json_get
- Sets:
redis_smembers (or redis_scard for large sets)
- Sorted sets:
redis_zrange with limit
- Lists:
redis_lrange with limit
- Streams:
redis_xrange with count
Step 4: Present the profile
Database Overview:
| Metric | Value |
|---|
| Total keys | |
| Memory used | |
| Peak memory | |
Key Patterns:
| Pattern | Type | Count (est.) | Avg Size | TTL | Sample |
|---|
| user:* | hash | ~5,000 | 256 bytes | none | {name: "Alice", ...} |
| session:* | string | ~12,000 | 128 bytes | 1800s | {token data} |
| cache:* | JSON | ~800 | 1.2 KB | 3600s | {nested doc} |
Step 5: Identify patterns and anomalies
Flag anything noteworthy:
- Big keys: Any key using significantly more memory than its peers
- No TTL on cache-like data: Keys that look ephemeral but have no expiry
- Encoding surprises: Large sorted sets that have moved from ziplist to skiplist
- Empty or near-empty keys: Keys that exist but have minimal data
- Hot key candidates: Use
redis_hotkeys if available
Step 6: Suggest next steps
Based on what you found, suggest relevant skills:
- Found JSON docs? -> "Consider running index-advisor to set up search"
- Found TTL-based patterns? -> "The data-modeling-advisor can evaluate your TTL strategy"
- Found large datasets? -> "Use compare-approaches to evaluate different data structures"
- Found memory concerns? -> "Check redis_info memory and consider eviction policies"
Tips
- SCAN is cursor-based and safe for production; it won't block the server
- Memory usage per key includes overhead (encoding, pointers); don't be surprised if a 10-byte string uses 80 bytes
- TTL of -1 means no expiry; TTL of -2 means the key doesn't exist
- For large databases, sample rather than scan everything -- 100-500 keys per pattern is sufficient
- If the database is empty or nearly empty, say so -- don't force a deep analysis on nothing