Summary

Query runs 2 operators; returns 100 rows in 0.08 ms. Main finding: Row estimate off by 10× or more: ss (estimated 1,666, actual 100 rows per loop, 17× over).

Total time
84 µs
Rows returned
100
Rows examined
100
Operators
2
Fix first

Primary recommendation

Refresh statistics with ANALYZE TABLE ss. If a filter on a non-indexed column stays misestimated, add a histogram: on MySQL 8.0+, ANALYZE TABLE ss UPDATE HISTOGRAM ON <column> WITH 100 BUCKETS; on MariaDB, ANALYZE TABLE ss PERSISTENT FOR COLUMNS (<column>) INDEXES ().

Why does this help?

the optimizer picks join order and access methods from these estimates. InnoDB recalculates persistent statistics on its own only after about 10% of a table's rows change, and on MariaDB, under the default use_stat_tables=PREFERABLY_FOR_QUERIES, ANALYZE TABLE collects column statistics and histograms only when you add PERSISTENT FOR.

SQL

select testdb.ss.g AS g,testdb.ss.v AS v
from testdb.ss
where (testdb.ss.v > 4900)

Execution plan (flamegraph)

Click a plan operator to inspect details.

Warnings (1)

  1. WARN

    Row estimate off by 10× or more: ss (estimated 1,666, actual 100 rows per loop, 17× over)

    Labeled: Covering index [ss.g]

Suggestions (1)

  1. MEDIUM

    Refresh statistics with ANALYZE TABLE ss. If a filter on a non-indexed column stays misestimated, add a histogram: on MySQL 8.0+, ANALYZE TABLE ss UPDATE HISTOGRAM ON <column> WITH 100 BUCKETS; on MariaDB, ANALYZE TABLE ss PERSISTENT FOR COLUMNS (<column>) INDEXES ().

    Why?

    the optimizer picks join order and access methods from these estimates. InnoDB recalculates persistent statistics on its own only after about 10% of a table's rows change, and on MariaDB, under the default use_stat_tables=PREFERABLY_FOR_QUERIES, ANALYZE TABLE collects column statistics and histograms only when you add PERSISTENT FOR.

Agent-ready · token savings

Feeding this plan to an AI as the myflames digest instead of raw EXPLAIN JSON cuts the prompt by 1.2× (15.1% fewer tokens).

Raw plan
392 tokens
myflames digest
333 tokens
Saved
59 tokens
Per 1,000 queries
~$0.18 saved

Estimate (heuristic estimate (offline)). Prices as of 2026-05-26 (Sonnet 4.6 input). Generate the digest with myflames digest.

myteach — interactive algorithm catalog

Every operator shown above has a hands-on lesson with a cost-model slider and an animated walk-through. The catalog is the central index — bookmark it once, revisit per query:

Open the full catalog →

Raw sidecar (JSON)

{
  "$schema": "https://myflames.dev/schemas/sidecar-v1.json",
  "schema_version": "1.3",
  "generated_at": "2026-10-15T19:53:28Z",
  "myflames_version": "2.3.0",
  "source": {
    "type": "file"
  },
  "plan_summary": {
    "total_time_ms": 0.084,
    "rows_sent": 100,
    "rows_examined_estimate": 100,
    "operator_count": 2,
    "max_depth": 2
  },
  "optimizer_switches": [
    {
      "name": "skip_scan",
      "value": "on",
      "explanation": "Uses a composite index even though the query does not filter on the leading column, by probing each distinct leading-column value. Only pays off when the leading column has very low cardinality.",
      "node_labels": [
        "Covering index [ss.g]"
      ]
    }
  ],
  "warnings": [
    {
      "severity": "warn",
      "category": "misestimate",
      "text": "Row estimate off by 10× or more: ss (estimated 1,666, actual 100 rows per loop, 17× over)",
      "source": "plan",
      "node_labels": [
        "Covering index [ss.g]"
      ]
    }
  ],
  "suggestions": [
    {
      "severity": "medium",
      "category": "statistics",
      "action": "Refresh statistics with ANALYZE TABLE ss. If a filter on a non-indexed column stays misestimated, add a histogram: on MySQL 8.0+, ANALYZE TABLE ss UPDATE HISTOGRAM ON <column> WITH 100 BUCKETS; on MariaDB, ANALYZE TABLE ss PERSISTENT FOR COLUMNS (<column>) INDEXES ().",
      "source": "plan",
      "why": "the optimizer picks join order and access methods from these estimates. InnoDB recalculates persistent statistics on its own only after about 10% of a table's rows change, and on MariaDB, under the default use_stat_tables=PREFERABLY_FOR_QUERIES, ANALYZE TABLE collects column statistics and histograms only when you add PERSISTENT FOR."
    }
  ],
  "executive_summary": "Query runs 2 operators; returns 100 rows in 0.08 ms. Main finding: Row estimate off by 10× or more: ss (estimated 1,666, actual 100 rows per loop, 17× over).",
  "plan_tree": {
    "node_id": "n:73b39ab87252",
    "short_label": "Filter: ((ss.v > 4900))",
    "folded_label": "FILTER ((ss.v > 4900)) starts=1 rows=100",
    "children": [
      {
        "node_id": "n:df672e70bc82",
        "short_label": "Covering index [ss.g]",
        "folded_label": "COVERING INDEX [ss.g] starts=1 rows=100",
        "children": []
      }
    ]
  },
  "query": {
    "raw": "/* select#1 */ select `testdb`.`ss`.`g` AS `g`,`testdb`.`ss`.`v` AS `v` from `testdb`.`ss` where (`testdb`.`ss`.`v` > 4900)",
    "beautified": "select testdb.ss.g AS g,testdb.ss.v AS v\nfrom testdb.ss\nwhere (testdb.ss.v > 4900)"
  },
  "primary_action": {
    "ref": "suggestions[0]"
  },
  "teach_hooks": [
    {
      "lesson": "filter",
      "match": {
        "folded_label": "FILTER ((ss.v > 4900)) starts=1 rows=100",
        "short_label": "Filter: ((ss.v > 4900))"
      },
      "controls": {
        "input_rows": 100,
        "selectivity": 6.0
      },
      "note": "Filter: (ss.v > 4900)",
      "query_sql": "/* select#1 */ select `testdb`.`ss`.`g` AS `g`,`testdb`.`ss`.`v` AS `v` from `testdb`.`ss` where (`testdb`.`ss`.`v` > 4900)"
    },
    {
      "lesson": "skip_scan",
      "match": {
        "folded_label": "COVERING INDEX [ss.g] starts=1 rows=100",
        "short_label": "Covering index [ss.g]"
      },
      "controls": {
        "table_rows": 100,
        "ndv_leading": 5,
        "selectivity": 10
      },
      "note": "Covering index skip scan on ss using g over 4900 < v (ss)",
      "query_sql": "/* select#1 */ select `testdb`.`ss`.`g` AS `g`,`testdb`.`ss`.`v` AS `v` from `testdb`.`ss` where (`testdb`.`ss`.`v` > 4900)"
    }
  ],
  "operator_complexities": [
    {
      "node_id": "n:df672e70bc82",
      "folded_label": "COVERING INDEX [ss.g] starts=1 rows=100",
      "short_label": "Covering index [ss.g]",
      "complexity": {
        "big_o": "O(n)",
        "short": "n",
        "severity": "good",
        "rationale": "Covering index scan: walks the whole index in key order but never touches the clustered tree — all selected columns fit on the index leaves.",
        "confidence": "exact",
        "learn_more": "covering_index"
      }
    }
  ]
}

Teach: Operator deep dive