sql-correlated-subquery-rewrite
Optimize a SQL query over a large unindexed table by collapsing repeated correlated subqueries or per-group "top-N" lookups into a single computation, then verify output equivalence. Trigger when the task needs one rewritten SQL deliverable and schema inspection shows no indexes.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-12
- Stars
- ★ 394
- Forks
- 23
01 前言 Front Matter
- name
- sql-correlated-subquery-rewrite
- flashrsi
- { "level": "topic", "algorithm": "evo_harness", "source_task_ids": [ "query-optimize" ] }
- description
- Optimize a SQL query over a large unindexed table by collapsing repeated correlated subqueries or per-group "top-N" lookups into a single computation, then verify output equivalence. Trigger when the task needs one rewritten SQL deliverable and schema inspection shows no indexes.
03 SKILL.md 正文
Inspect once, then write. Do a single quick pass over schema/index/count facts
(e.g. CREATE TABLE, indexes, row counts), then stop deliberating and write a
first candidate rewrite to the target file immediately. Do not loop in hidden
thinking between inspection and emitting the solution.
Collapse repeated per-group subqueries. When the input query re-derives the same
top-N-per-group value more than once through identical
GROUP BY ... ORDER BY ... LIMIT 1 logic, compute it once per group using a CTE
or window function (e.g. ROW_NUMBER() OVER (PARTITION BY ... ORDER BY ...)),
and reference that single result everywhere it is used.
Validate equivalence. After writing, run the rewrite and diff its output against the original query's output; correct any discrepancy before finishing.
04 同仓库更多 Skills
dynamic-resources
Example skill loaded from resources_discover
hermes-agent
Use the FlashRSI Hermes Snapshot's headless Python runtime, tools, sessions, and compression paths.
skill-installer
Install Codex skills into $CODEX_HOME/skills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos).
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Codex's capabilities with specialized knowledge, workflows, or tool integrations.
review-agent
Perform a read-only, defect-first review of a specified code change and return every actionable finding. Use when another agent delegates review of uncommitted changes, a base-branch diff, a commit, or custom review instructions.
plugin-creator
Create and scaffold plugin directories for Codex with a required `.codex-plugin/plugin.json`, optional plugin folders/files, valid manifest defaults, and personal-marketplace entries by default. Use when Codex needs to create a new personal plugin, add optional plugin structure, generate or update marketplace entries for plugin ordering and availability metadata, or update an existing local plugin during development with the CLI-driven cachebuster and reinstall flow.