Token导航 LogoToken导航

Agent Skill · 待分类

analyzing-range-distribution(分析范围分布)

analyzing-range-distribution 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

analyzing-range-distribution 是待分类类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描已通过,按安装量在待分类类的 11,209 个 Skill 里排第 6,484。

总安装 447周安装 19GitHub Stars 9下载 157核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:analyzing-range-distribution(分析范围分布)
来源仓库:https://github.com/cockroachlabs/cockroachdb-skills
仓库路径:skills/analyzing-range-distribution
安装命令:
npx skills add https://github.com/cockroachlabs/cockroachdb-skills --skill analyzing-range-distribution
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/cockroachlabs/cockroachdb-skills --skill analyzing-range-distribution

这个 Skill 是做什么的

这个 Skill 的分类还没最终确定,用法以来源仓库的说明为准。

分析 CockroachDB 范围分布与区域配置合规性。适用于检查范围数量异常、大小失衡和租约热点。使用 SHOW RANGES 和 SHOW ZONE CONFIGURATIONS 命令进行 SQL 分析。无需 DB Console 访问权限,适合运维容量规划。补充查询性能分析,聚焦数据分布而非语句模式。

来源仓库内路径:skills/analyzing-range-distribution

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/cockroachlabs/cockroachdb-skills --skill analy…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

analyzing-range-distribution 怎么安装?

在终端执行 npx skills add https://github.com/cockroachlabs/cockroachdb-skills --skill analyzing-range…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

analyzing-range-distribution 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

analyzing-range-distribution 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

analyzing-range-distribution 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

analyzing-range-distribution 用的人多吗?

公开数据是累计安装 447 次,近一周安装 19 次,下载 157 次,GitHub 9 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

analyzing-range-distribution 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理待分类类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

待分类类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
infsh-cli

infsh CLI · Codex、Claude

4,374,576382权限未标注未明确未收录
ai-video-generation

AI 视频生成 · Codex、Claude

4,313,376382调用外部服务未明确有提醒
lark-openapi-explorer

云雀 OpenAPI 浏览器 · Codex、Claude

2,064,1209,011需要联网未明确有提醒
lark-workflow-standup-report

Lark 工作流程站立报告 · Codex、Claude

2,041,6328,978需要联网未明确通过
use-my-browser

使用我的浏览器 · Codex、Claude

1,848,49140操作浏览器未明确未通过
analyzing-range-distribution

分析范围分布 · 本页

4479只读未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Analyzing Range Distribution

Analyzes CockroachDB range distribution, leaseholder placement, and zone configuration compliance using SHOW RANGES and SHOW ZONE CONFIGURATIONS commands. Identifies range count anomalies, size imbalances, leaseholder hotspots, and replication issues - entirely via SQL without requiring DB Console access.

Complement to profiling skills: This skill analyzes range-level data distribution; for query performance patterns, see profiling-statement-fingerprints. For schema change storage planning, see analyzing-schema-change-storage-risk.

When to Use This Skill

  • Identify tables/indexes with excessive range counts indicating fragmentation
  • Detect range size imbalances or uneven data distribution across nodes
  • Investigate leaseholder concentration causing read hotspots
  • Validate zone configuration effects on range placement and replica distribution
  • Diagnose range-level replication issues (under-replicated or unavailable ranges)
  • Analyze range split patterns from high write volume
  • SQL-only range analysis without DB Console access

For schema change planning: Use analyzing-schema-change-storage-risk to estimate storage requirements before CREATE INDEX or ADD COLUMN operations.

Prerequisites

  • SQL connection to CockroachDB cluster
  • Admin role OR ZONECONFIG system privilege
  • Understanding of CockroachDB range architecture (64MB default max size)
  • Knowledge of cluster topology (node IDs, regions, availability zones)

Check your privileges:

SHOW GRANTS ON SYSTEM FOR current_user;  -- Should show admin or ZONECONFIG

See permissions reference for RBAC setup.

Core Concepts

Ranges: Units of Data Distribution

Range: Contiguous key space segment (default 64MB max size, configurable via zone config range_max_bytes) Raft group: Each range replicated across nodes (default 3 replicas) Leaseholder: Single replica handling reads and coordinating writes for a range

Critical: Ranges split automatically at 64MB by default, but can fragment further due to load-based splitting during high write traffic.

Leaseholders and Hotspots

Leaseholder concentration: Single node holding disproportionate leaseholders = read hotspot Load-based splitting: CockroachDB splits ranges experiencing high QPS, increasing range count Hotspot symptoms: High CPU on single node, slow reads on specific table/index

Range Fragmentation

Fragmentation: Excessive range splits creating many small ranges (overhead from Raft coordination) Causes: High write throughput, sequential inserts (timestamp-based primary keys), load-based splitting Symptoms: High range count relative to data size, increased latency from Raft overhead

Fragmentation metric: Ranges per GB (healthy: 1-15, fragmented: 50+)

Zone Configurations

Zone config: Replication and placement policies for databases, tables, or indexes Replication factor: Number of replicas per range (default: 3) Constraints: Node placement rules (region, availability zone, node attributes)

Use case: Validate intended zone config matches actual range placement.

SHOW RANGES DETAILS Option

CRITICAL SAFETY WARNING: The WITH DETAILS option computes span_stats (range size, key counts) on-demand, causing:

  • High CPU usage from statistics computation
  • Memory overhead proportional to range count
  • Query timeouts on large tables without LIMIT

Best practice: Always use LIMIT with DETAILS, target specific tables/indexes, avoid cluster-wide scans.

Core Diagnostic Queries

Query 1: Range Count by Table (Production-Safe)

SELECT
  table_name,
  index_name,
  COUNT(*) AS range_count
FROM [SHOW RANGES FROM TABLE your_table_name]
GROUP BY table_name, index_name
ORDER BY range_count DESC;

Interpretation: High range count (1000s) on small tables indicates fragmentation. Cross-reference with table size.

Safety: No DETAILS option = production-safe, minimal overhead.

Query 2: Range Size Analysis (Targeted DETAILS)

SELECT
  range_id,
  start_key,
  end_key,
  (span_stats->>'approximate_disk_bytes')::INT / 1048576 AS size_mb,
  lease_holder,
  replicas
FROM [SHOW RANGES FROM TABLE your_table_name WITH DETAILS]
ORDER BY (span_stats->>'approximate_disk_bytes')::INT DESC
LIMIT 50;

Interpretation: Large ranges (>64MB) indicate split lag; many small ranges (<10MB) indicate fragmentation.

CRITICAL: Always include LIMIT and target specific tables. Never run SHOW RANGES WITH DETAILS on entire database.

Query 3: Leaseholder Distribution (Hotspot Detection)

SELECT
  lease_holder,
  COUNT(*) AS leaseholder_count,
  ROUND(COUNT(*) * 100.0 / SUM(COUNT(*)) OVER (), 2) AS percentage
FROM [SHOW RANGES FROM TABLE your_table_name]
GROUP BY lease_holder
ORDER BY leaseholder_count DESC;

Interpretation: >40% leaseholders on single node in balanced cluster = hotspot. Check if table has zone constraints favoring specific nodes.

Remediation: Use ALTER TABLE... CONFIGURE ZONE USING lease_preferences to spread leaseholders.

Query 4: Range Replication Health Check

SELECT
  range_id,
  start_key,
  replicas,
  array_length(replicas, 1) AS replica_count,
  voting_replicas,
  array_length(voting_replicas, 1) AS voting_replica_count,
  lease_holder
FROM [SHOW RANGES FROM TABLE your_table_name]
WHERE array_length(replicas, 1) < 3  -- Under-replicated
ORDER BY range_id
LIMIT 100;

Interpretation: replica_count < 3 = under-replicated (data loss risk). Check for node failures, decommissioning operations, or zone config mismatches.

Safety: No DETAILS = production-safe.

Query 5: Zone Configuration Audit

SHOW ZONE CONFIGURATIONS;

Output columns:

  • target: Database, table, or index
  • raw_config_sql: Zone config SQL (replication factor, constraints)

Use case: Validate intended replication factor and placement constraints match expected design.

Cross-reference: Compare zone configs with Query 3 (leaseholder distribution) and Query 4 (replica health) to validate actual placement.

Query 6: Fragmentation Analysis (Ranges per GB)

WITH range_counts AS (
  SELECT
    table_name,
    index_name,
    COUNT(*) AS range_count
  FROM [SHOW RANGES FROM TABLE your_table_name]
  GROUP BY table_name, index_name
),
table_sizes AS (
  SELECT
    table_name,
    SUM((span_stats->>'approximate_disk_bytes')::INT) / 1073741824.0 AS size_gb
  FROM [SHOW RANGES FROM TABLE your_table_name WITH DETAILS]
  GROUP BY table_name
)
SELECT
  rc.table_name,
  rc.index_name,
  rc.range_count,
  ts.size_gb,
  ROUND(rc.range_count / NULLIF(ts.size_gb, 0), 2) AS ranges_per_gb
FROM range_counts rc
JOIN table_sizes ts ON rc.table_name = ts.table_name
ORDER BY ranges_per_gb DESC;

Interpretation:

  • Healthy: 1-15 ranges/GB
  • Moderate fragmentation: 16-50 ranges/GB
  • Severe fragmentation: 50+ ranges/GB

CRITICAL: This query uses DETAILS - only run on targeted tables with known size, never cluster-wide.

Remediation: Increase range_max_bytes via zone config (with caution), or accept fragmentation if caused by necessary load-based splitting.

See sql-queries reference for complete query variations and guardrails.

Common Workflows

Workflow 1: Hotspot Investigation

Scenario: Single node experiencing high CPU, slow reads on specific table.

Steps:

  1. Identify leaseholder concentration: Run Query 3 on suspected table
  2. Validate zone config: Run Query 5 to check lease_preferences
  3. Check for load-based splits: Run Query 1 to detect recent range fragmentation (symptom of hotspot)
  4. Remediate: Configure lease preferences to spread reads, or partition table if hotspot is on sequential key range

Example:

-- Check leaseholder distribution
SELECT lease_holder, COUNT(*) FROM [SHOW RANGES FROM TABLE hot_table] GROUP BY lease_holder;

-- Validate zone config
SHOW ZONE CONFIGURATION FOR TABLE hot_table;

-- Spread leaseholders if concentrated
ALTER TABLE hot_table CONFIGURE ZONE USING lease_preferences = '[[+region=us-west]]';

Workflow 2: Zone Config Validation

Scenario: After configuring multi-region setup, validate ranges are placed according to constraints.

Steps:

  1. Review intended configs: Run Query 5 (SHOW ZONE CONFIGURATIONS)
  2. Check actual replica placement: Run Query 4 on critical tables, inspect replicas array for node IDs
  3. Map node IDs to regions: Cross-reference with SHOW REGIONS or crdb_internal.gossip_nodes
  4. Identify mismatches: Ranges not matching constraints indicate rebalancing in progress or misconfiguration

Example:

-- Show zone config
SHOW ZONE CONFIGURATION FOR TABLE multi_region_table;

-- Check replica placement
SELECT range_id, replicas FROM [SHOW RANGES FROM TABLE multi_region_table] LIMIT 20;

-- Map node IDs to regions
SELECT node_id, locality FROM crdb_internal.gossip_nodes;

Workflow 3: Fragmentation Diagnosis

Scenario: Table with high range count relative to size, experiencing latency.

Steps:

  1. Calculate ranges per GB: Run Query 6 (targeted to specific table)
  2. Check for load-based splits: Review write patterns (sequential inserts, high QPS periods)
  3. Determine if expected: Fragmentation may be intentional for load distribution
  4. Remediate if excessive: Increase range_max_bytes (with caution - larger ranges = slower splits), or investigate reducing write hotspots

CRITICAL: Never increase range_max_bytes above 512MB without understanding impact on split/rebalance performance.

Safety Considerations

DETAILS Option Cost

Resource impact:

  • CPU: Computes span statistics on-demand for each range
  • Memory: Proportional to range count returned
  • Timeout risk: High on tables with 1000s of ranges without LIMIT

Mitigation strategies:

  1. Always use LIMIT: Cap at 50-100 ranges for exploratory analysis
  2. Target specific tables: Use FROM TABLE table_name, never cluster-wide SHOW RANGES WITH DETAILS
  3. Use basic queries first: Run Query 1 (no DETAILS) to assess range count before using DETAILS
  4. Production timing: Run during maintenance windows or low-traffic periods

Privilege Safety

Admin role: Full cluster access, use with caution in production ZONECONFIG privilege: Limited to viewing ranges and zone configs, safer for read-only analysis

Best practice: Grant ZONECONFIG instead of admin for range analysis operators.

See permissions reference for granting minimal privileges.

Production Impact

Read-only operations: All queries are SELECT or SHOW statements with no writes.

Performance considerations:

Query TypeImpactSafe for Production?
Basic SHOW RANGESMinimal CPU, metadata-onlyYes
SHOW RANGES WITH DETAILS (targeted, LIMIT 50)Moderate CPU spikeYes (low-traffic window)
SHOW RANGES WITH DETAILS (no LIMIT)High CPU, timeout riskNO - NEVER USE
SHOW ZONE CONFIGURATIONSMinimal, metadata-onlyYes

Troubleshooting

IssueCauseFix
Permission deniedMissing admin or ZONECONFIG privilegeGrant ZONECONFIG: GRANT SYSTEM ZONECONFIG TO user
Query timeout with DETAILSToo many ranges without LIMITAdd LIMIT 50, target specific table
Empty span_stats columnMissing DETAILS keywordAdd WITH DETAILS to SHOW RANGES
Unexpected high range countLoad-based splitting or fragmentationRun Query 6 to calculate ranges/GB, review write patterns
Leaseholder = 0 or NULLRange in transition during rebalancingNormal during cluster changes, retry query
Under-replicated rangesNode failure, decommission, zone mismatchCheck node status, validate zone config constraints
SHOW ZONE CONFIGURATIONS shows no custom configsUsing default cluster-wide configNormal if no table/database-level overrides set

Key Considerations

  • DETAILS option: Expensive operation - always use with LIMIT and targeted scope
  • Fragmentation is sometimes intentional: Load-based splitting improves concurrency
  • Leaseholder concentration: Check zone configs (lease_preferences) before assuming hotspot
  • Range size target: Default 64MB max (not 512MB as in older versions)
  • Replication lag: Range placement may not immediately reflect zone config changes (rebalancing takes time)
  • Cross-reference queries: Combine range analysis with zone configs for complete picture
  • Node mapping: Use crdb_internal.gossip_nodes to map node IDs to regions/zones

References

Skill references:

Official CockroachDB Documentation:

Related skills:

平台分布

Codex

35.78%
按下载量换算56

Claude

31.43%
按下载量换算49

Cursor

19.73%
按下载量换算31

Gemini CLI

9.29%
按下载量换算15

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills