← ClaudeAtlas

pythia-tunelisted

Use when a query, report or PL/SQL unit is slow, before adding an index or a hint, or when someone says "cham", "toi uu truy van", "optimize this query", "why is this report slow", "full table scan". Measures with the optimizer's own plan and statistics, changes one thing at a time, and proves the gain with the same measurement - license-safe, no AWR/ASH or Tuning Pack.
thaildhe172591/pythia · ★ 4 · AI & Automation · score 77
Install: claude install-skill thaildhe172591/pythia
# Tuning a Query or a Unit **Announce at start:** "Using pythia-tune — measuring before changing anything." **Phase:** Learn → Ask → Do — the plan and the statistics first, one proposed change, the same measurement after Performance folklore is the most confident kind of wrong. "Add an index", "use a hint", "rewrite it as a join" — each is right for some plans and harmful for others, and only the plan says which. Tuning without a before and after is guessing with extra steps. ## The Iron Law ``` NO TUNING CHANGE WITHOUT A MEASUREMENT BEFORE AND THE SAME ONE AFTER ``` ## The Workflow 1. **Get the real statement.** The exact SQL the application runs — from `pythia src` / `pythia grep`, with its bind variables as binds (`:id`), not pasted literals: a literal can get a different plan than the bind. 2. **Measure.** - `pythia explain "<the select>"` — the optimizer's plan; read rows (cardinality), cost, the access path per table, and the `-- note:` lines pythia adds (full scans, Cartesian joins, implicit conversions, dynamic sampling). - `pythia stats <TABLE>` for each table in the plan — row counts, when statistics were gathered, STALE, the indexes and their columns, unindexed foreign keys. - For DML, explain the `SELECT` that finds its rows. 3. **Diagnose with the checklist** (`reference/tuning-checklist.md`), in order — cheapest and most common causes first: statistics, a predicate that cannot use an index, the wrong or missin