Token导航 LogoToken导航

Agent Skill · 研究检索

reduce-unoptimized-query-oracle(reduce unoptimized query Oracle 搜索)

reduce-unoptimized-query-oracle 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

reduce-unoptimized-query-oracle 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 39,036。

总安装 1,473周安装 62GitHub Stars 32,061下载 516核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/cockroachdb/cockroach --skill reduce-unoptimized-query-oracle

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找和筛选与数据库查询优化相关的信息。适合在性能调优或 SQL 优化场景中定位候选方案。需结合具体数据库类型和查询模式进行验证。使用前请确认是否具备相应数据库访问权限。reduce-unoptimized-query-oracle 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/reduce-unoptimized-query-oracle

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

reduce-unoptimized-query-oracle 怎么安装?

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

reduce-unoptimized-query-oracle 支持哪些 AI 工具?

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

reduce-unoptimized-query-oracle 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

reduce-unoptimized-query-oracle 是免费的吗?

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

reduce-unoptimized-query-oracle 用的人多吗?

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

reduce-unoptimized-query-oracle 安全吗?

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

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 来源仓库有 32,061 星,维护活跃度相对可查。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

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

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
reduce-unoptimized-query-oracle

reduce unoptimized query Oracle 搜索 · 本页

1,47332,061接触敏感数据未明确通过

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

SKILL.md 原文

Reduce Unoptimized Query Oracle Test Failure

Reduce an unoptimized-query-oracle test failure log to the simplest possible reproduction case.

The unoptimized-query-oracle roachtest runs a series of random SQL statements to create a random dataset, and then executes a random "Query of Interest" twice, with different optimization settings. If the two executions return different results, it indicates a bug in CockroachDB.

When to Use

Use this skill when:

  • You have a test failure from the unoptimized-query-oracle roachtest.
  • You need to find the minimal SQL to reproduce the test failure.

Step 1: Locate artifacts

Ask the user where the artifacts directory is.

Find the relevant files in the artifacts directory:

  • Test parameters: params.log (the parameters from the roachtest)
  • Test log: test.log (the log from the roachtest)
  • Failure log: failure*.log (the failure log from the roachtest)
  • Full SQL log: unoptimized-query-oracle*.log (the SQL statements that led to failure)
  • Query of interest log: unoptimized-query-oracle*.failure.log (containing the query of interest and possibly more information about the failure)
  • Cockroach log: logs/1.unredacted/cockroach.log or logs/unredacted/cockroach.log (contains the git commit)

Step 2: Determine test configuration

Determine the git commit from cockroach.log:

grep "binary: CockroachDB" cockroach.log

Look for the commit hash in the version string (e.g., cb94db961b8f55e3473f279d98ae90f0eeb0adcb).

Determine if runtime assertions are enabled by checking for:

  • "runtimeAssertionsBuild": "true" in params.log
  • or Runtime assertions enabled in test.log

Determine if metamorphic settings apply by looking for:

  • lines like these in params.log: "metamorphicBufferedSender": "true", "metamorphicWriteBuffering": "true",
  • or lines like these in test.log: metamorphically setting "kv.rangefeed.buffered_sender.enabled" to 'true' metamorphically setting "kv.transaction.write_buffering.enabled" to 'true'

Determine environment variables from the beginning of cockroach.log:

grep -A10 "using local environment variables:" cockroach.log

Important environment variables include:

  • COCKROACH_INTERNAL_CHECK_CONSISTENCY_FATAL
  • COCKROACH_INTERNAL_DISABLE_METAMORPHIC_TESTING
  • COCKROACH_RANDOM_SEED
  • COCKROACH_TESTING_FORCE_RELEASE_BRANCH But there might be more important environment variables, so best to get all of them.

Determine if this is a multi-region test or single-region test by checking:

  • the test name (e.g., seed-multi-region in test.log indicates multi-region)
  • or the presence of \connect lines in the full SQL log If both of these are missing, it's a single-region test.

Step 3: Check Out and Build

For a normal build use:

git checkout <commit-hash>
./dev build short

If runtime assertions were enabled, use a test build instead:

git checkout <commit-hash>
./dev build short -- --crdb_test

Note: Only build libgeos if the reproduction uses geospatial functions (BOX2D, geometry, geography, etc.):

./dev build libgeos

Step 4: Prepare the Full SQL Log File

First, check that the following statements are at the top of the full SQL log file. If they are not, add them:

SET statement_timeout='1m0s';
SET sql_safe_updates = false;

If metamorphic settings were used, also add them to the top of the full SQL log file:

SET CLUSTER SETTING kv.rangefeed.buffered_sender.enabled = true;
SET CLUSTER SETTING kv.transaction.write_buffering.enabled = true;

Create an appropriate directory either in the artifacts directory or in the repository root for holding temp files.

Step 5: Initial Reproduction

Determine the correct demo command based on test type:

  • Multi-region test: Use --nodes=9
  • Single-region test: Omit --nodes option

Use a command like this to try reproducing the test failure from the full SQL log file. This command could take up to 20 minutes to finish.

<env vars> ./cockroach demo --multitenant=false --nodes=9 --insecure --set=errexit=false --no-example-database --format=tsv -f <full-sql-log-file>

Check that the output reproduces the test failure described in the failure log. There are many possible failure modes. Look for one of the following, which should match the failure log:

  1. Different results between the two executions of the "Query of Interest" (which is the randomly generated SELECT statement repeated twice near the end of the log, wrapped in various SET and RESET staements). These different results could take the form of different result sets, or could also be an error in one case and no error in the other case. This is an "oracle" failure.
  2. Or, internal error or assertion failure. Note the error message for the reduce step.
  3. Or, a panic. Note the error message for the reduce step.
  4. Or, a timeout. Note the statement that timed out.

Troubleshooting

IMPORTANT: Many failures are nondeterministic, especially for multi-region tests. If no failure happens on the first run, try up to 10 times before concluding it doesn't reproduce.

It can be helpful at this point to compare the output with the failure*.log which should show the failure from the original test run.

If the initial run fails to reproduce after 10 times, pause here and report to the user that the failure cannot be reproduced, and show the command that was tried. The user might have additional instructions.

If it looks like it reproduces, it's time to move on to the next step.

Step 6: Use the Reduce Tool

Build the reduce tool:

./dev build reduce

Prepare the Full SQL Log File again

For multi-region tests, remove \connect lines (they cause syntax errors in the reduce tool):

grep -v '^\\connect' <full-sql-log-file> > <cleaned-log>

Run Reduce

IMPORTANT: The reduce tool must be run from the cockroach repository root directory, because it looks for ./cockroach in the current directory.

Use the -multi-region option for multi-region tests, or omit it for single-region tests.

For "oracle" failures (different results):

./bin/reduce -unoptimized-query-oracle -multi-region -chunk 25 -v -file <cleaned-log> 2>&1 | tee reduce-output.log

The -unoptimized-query-oracle option checks whether the two executions of the "Query of Interest" produce the same results.

For internal errors/assertion failures/panics:

./bin/reduce -contains "<error-regex>" -multi-region -chunk 25 -v -file <cleaned-log> 2>&1 | tee reduce-output.log

Use a distinctive part of the error message as the -contains regex (e.g., "nil LeafTxnInputState").

The reduce tool might take up to an hour to run.

Extract the Reduced SQL

The reduce tool outputs progress lines followed by the final SQL. Extract just the SQL:

grep -A1000 "^reduction: " reduce-output.log | tail -n +2 > reduced.sql

IMPORTANT: Immediately save a backup of the reduce output before manual simplification:

cp reduced.sql reduced_original.sql

This provides a recovery point if the working file gets corrupted during simplification.

If the reduce tool fails to reproduce, pause here and report this to the user. They might have additional instructions. Occasionally we have to modify the reduce tool itself, if the test failure is not reproducing.

Step 7: Create Test Script and Determine Reproduction Rate

IMPORTANT: Many bugs are nondeterministic. Before manual simplification, create a reusable test script and determine the reproduction rate.

Create a small test script (adjust as needed):

cat > test_repro.sh << 'EOF'
#!/bin/bash
# Test if reduced_v2.sql reproduces the error (exits on first success, up to 10 attempts)
for i in {1..10}; do
  if ./cockroach demo --multitenant=false --nodes=9 --insecure \
     --set=errexit=false --no-example-database --format=tsv \
     -f reduced_v2.sql 2>&1 | grep -q "<error-pattern>"; then
    echo "Run $i: REPRODUCED"
    exit 0
  else
    echo "Run $i: no error"
  fi
done
echo "FAILED"
EOF
chmod +x test_repro.sh

For "oracle" failures, instead of checking for an error pattern, the test script probably needs to isolate and diff the results of the two executions of the "Query of Interest".

Run the test script to determine the reproduction rate. It's not always 100%.

This rate determines how many attempts you need when testing simplifications:

  • 100% rate: Single attempt sufficient
  • 50% rate: 2-3 attempts usually sufficient
  • 10% rate: Need ~10 attempts to be confident
  • <5% rate: May need 20+ attempts

Note that in some cases, the following settings might need to be added back to the reduced file to get a repro:

SET statement_timeout='1m0s';
SET sql_safe_updates = false;

If the reduced SQL fails to reproduce after 10 attempts, pause here and report this to the user. They might have additional instructions.

Step 8: Manual Simplification

Now iteratively simplify the SQL while maintaining reproduction.

CRITICAL: For nondeterministic failures, you MUST test each simplification with enough attempts based on the repro rate. A single failed attempt does NOT mean the simplification broke the repro - it may just be nondeterminism.

Workflow for Each Simplification

  1. Copy reduced.sql to reduced_v2.sql
  2. Make ONE small change to reduced_v2.sql
  3. Run ./test_repro.sh (which tests reduced_v2.sql)
  4. If it reproduces: Copy reduced_v2.sql to reduced.sql, continue simplifying
  5. If it doesn't reproduce after enough attempts: Discard reduced_v2.sql, try a different change (i.e. backtrack).

This workflow avoids needing to restore files - you always keep the last working version in reduced.sql.

IMPORTANT: Run copy, edit, and test as separate bash commands (not chained with &&). This reduces the number of permission checks.

What to Try Removing (in rough order)

  1. Query projections and aggregations - Simplify SELECT list to just essential columns
  2. Query predicates - Simplify WHERE clause
  3. Indexes - Try removing secondary indexes
  4. Query joins - Simplify WHERE clause
  5. Columns from CREATE TABLE - Remove columns not referenced in the failing query
  6. Weird characters - Remove or replace non-ASCII characters from names and data
  7. other SQL simplifications

**For "oracle" failures, when editing the Query of Interest, be sure to edit *BOTH* copies of the Query of Interest so that they are identical.** Otherwise it won't be an apples-to-apples comparison when diffing the result sets.

Common Required Elements

These often cannot be removed:

  • Optimizer random seed: SET testing_optimizer_random_seed = <value> - this specific value often cannot be changed, as it determines which optimizer rules are disabled
  • Optimizer rule probability: SET testing_optimizer_disable_rule_probability

- affects query plan selection

  • Specific RESET/SET sequences for optimizer settings, such as distsql and vectorize
  • Certain indexes (affect query plans)
  • Multi-node setup (--nodes=9) for distributed query bugs (though try single-node first - it may work and is simpler)
  • CREATE STATISTICS statements (affect query planning)

Backtracking

If a change breaks reproduction:

  1. Discard reduced_v2.sql (don't copy it to reduced.sql)
  2. Verify reduced.sql still reproduces. If it doesn't, this means the repro is nondeterministic. (It might have started out nondeterministic, or might have become nondeterministic over the course of simplification.) Try reproducing it 10 times and note the new repro rate. Use the new repro rate to adjust the number of repro attempts during each simplification step going forward.
  3. Try a DIFFERENT simplification

Never continue simplifying from a broken state.

If you get stuck (i.e. cannot reproduce again after backtracking), stop and report to the user with the exact command you were trying.

Step 9: Final Verification and Output

After about 20 minutes of simplification, or if there are no more simplifications after backtracking a few times, it's time to stop.

  1. Run reproduction 10+ times to confirm stability and determine final repro rate
  2. Document the minimal reproduction steps
  3. Note which elements were required vs optional

Output

The final output should include two files that can be shown to the user:

  1. reduced.sql - The minimal SQL script that reproduces the bug
  2. bisect_run.sh - A script for use with git bisect run

Write the output in such a way that it could be copied and pasted into a terminal.

Example Output Format

(The commands in this output should be edited to match what was necessary to reproduce.)

# Minimal Reproduction

# reduced.sql
cat > reduced.sql << 'EOF'
CREATE TABLE t ();

SET testing_optimizer_random_seed = 1234567890;
SET testing_optimizer_disable_rule_probability = 0.5;

SELECT ...;
EOF

# bisect_run.sh
cat > bisect_run.sh << 'EOF'
#!/bin/bash
# Git bisect run script
# Exit codes: 0=good (bug not present), 1=bad (bug present), 125=skip (build failed)

REPO_DIR="/path/to/cockroach"
REPRO_SQL="/path/to/reduced.sql"

cd "$REPO_DIR" || exit 125

echo "=== Testing commit $(git rev-parse --short HEAD) ==="

# Build (use --crdb_test if runtime assertions were enabled in the original test)
if ! ./dev build short -- --crdb_test 2>&1 | grep -q "Successfully built"; then
    echo "BUILD FAILED - skipping"
    exit 125
fi

# Test for bug (try 3 times for flaky bugs)
for i in {1..3}; do
    if ./cockroach demo --multitenant=false --insecure \
        --set=errexit=false --no-example-database --format=tsv \
        -f "$REPRO_SQL" 2>&1 | grep -q "<error-pattern>"; then
        echo "BUG PRESENT - marking as BAD"
        exit 1
    fi
done

echo "Bug not present - marking as GOOD"
exit 0
EOF
chmod +x bisect_run.sh

# Command to reproduce
git checkout <commit-hash>
./bisect_run.sh

# Command to bisect
git bisect start ...
git bisect run bisect_run.sh

# Failure
# <paste stacktrace or relevant failure details here>

# Repro rate: ~X% (may need multiple attempts)

After showing this output, ask the user if they want to try reproducing the bug on master branch.

Optional Step 10: Check if Bug is Fixed on Master

Before bisecting, check whether the bug has already been fixed on master.

git stash  # if needed
git checkout master
./dev build short -- --crdb_test
./cockroach demo --multitenant=false --insecure --set=errexit=false --no-example-database --format=tsv -f reduced.sql

Run this a few times to account for flakiness. Note whether the bug reproduces on master or not.

Optional Step 11: Bisect

If the user wants to find the commit that introduced or fixed the bug, use git bisect.

If the Bug is Already Fixed on Master

Bisect to find the fix commit (the first commit where the bug no longer reproduces). Use custom terms since the "good" commit (master) is newer than the "bad" commit:

git bisect start --first-parent --term-old=broken --term-new=fixed
git bisect broken <commit-where-bug-exists>   # e.g., the original failing commit
git bisect fixed master                        # master is fixed

git bisect run ./bisect_run.sh

# When done
git bisect reset

Note: The --first-parent option follows only merge commits on the main branch, avoiding detours into feature branches. The bisect script must return 0 when the bug is NOT present (fixed) and 1 when the bug IS present (broken).

If the Bug Still Exists on Master

Bisect to find the regression commit (the first commit where the bug was introduced):

git bisect start --first-parent
git bisect good <known-good-commit>   # e.g., a previous release tag
git bisect bad master                  # master has the bug

git bisect run ./bisect_run.sh

# When done
git bisect reset

The bisect will identify the commit that introduced or fixed the bug.

Finding a Good Commit

If you don't know a good commit (where the bug doesn't exist), you can jump back in time to find one.

# Find a commit from ~6 months ago on the main branch
git rev-list --first-parent -1 --before="6 months ago" HEAD

Test whether the bug exists at that commit. If not, use it as the good commit for bisect. If the bug still exists, try going back further in time, but don't go back further than 1 year.

If a known good commit can't be found within 1 year, stop and report this to the user.

平台分布

Codex

32.9%
按下载量换算170

Claude

31.33%
按下载量换算162

Cursor

18.2%
按下载量换算94

Gemini CLI

8.69%
按下载量换算45

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

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

继续浏览同类 Skills