用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/redis/redisctl --skill query-tuning命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | query-tuning |
| description | Analyze and optimize RediSearch queries using FT.EXPLAIN and FT.PROFILE |
You are a Redis search query tuning expert. Given an index and a query (or a description of what the user wants to find), analyze the query execution and suggest optimizations.
Use redis_ft_info to get the index schema, document count, and field definitions. Note:
Use redis_ft_explain to get the query execution plan. This shows:
Use redis_ft_profile with command SEARCH to get timing data. Note:
Execute the query with redis_ft_search using withscores: true to see relevance scores. Check:
Common issues and fixes:
Slow TAG lookups on high-cardinality fields:
Missing SORTBY index:
SORTABLE enabledredis_ft_alter can only add NEW fields with SORTABLE — it cannot modify existing fieldsredis_ft_dropindex) and recreated (redis_ft_create) with the field marked SORTABLEInefficient filter ordering:
@category:{electronics} @price:[0 50] is better than @price:[0 50] @category:{electronics} if category has fewer matchesFull-text search too broad:
@name:wireless) instead of global search (wireless)Missing LIMIT:
Unnecessary RETURN fields:
return_fields to fetch only needed fields, reducing response sizeIf you suggested changes:
redis_ft_searchredis_ft_profile| Metric | Before | After | Improvement |
|---|---|---|---|
| Query time | |||
| Results scanned | |||
| Result quality |
If query optimization alone is insufficient, suggest index schema changes:
redis_ft_alterredis_ft_dropindex + redis_ft_create)Remind the user of useful query patterns:
@field:term -- field-specific search@field:{tag1|tag2} -- multi-value TAG match@field:[min max] -- numeric range (use -inf/+inf for unbounded)-@field:{value} -- negation@field:prefix* -- prefix matching"exact phrase" -- phrase matching(@field1:a | @field2:b) -- boolean OR