Summary

Query scans 1 table; examines ~3,004 rows to return 100 in 7.2 ms. Main finding: full scan of users (3,000 rows).

Total time
7.16 ms
Rows returned
100
Rows examined
3.00K
Operators
6
Fix first

Primary recommendation

Add indexes on filter/join columns to avoid full table scans

Why does this help?

An index turns a full-table scan into a direct lookup — MySQL jumps straight to the matching rows instead of reading every row and discarding the ones that don't match. For joins, the benefit compounds: a nested loop over N outer rows that had to scan the inner table becomes N fast lookups.

SQL

select u.id AS id,u.name AS name,count(o.id) AS order_count
from testdb.users u
left
  join testdb.orders o on((o.user_id = u.id))
where true
group by testdb.u.id,testdb.u.name
limit 100

Execution plan (workbench)

Click a plan operator to inspect details.

Warnings (1)

  1. WARN

    Full table scan: users (3000 rows)

    Labeled: Table scan [users]

Suggestions (1)

  1. HIGH

    Add indexes on filter/join columns to avoid full table scans

Agent-ready · token savings

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

Raw plan
954 tokens
myflames digest
191 tokens
Saved
763 tokens
Per 1,000 queries
~$2.29 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:26Z",
  "myflames_version": "2.3.0",
  "source": {
    "type": "file"
  },
  "plan_summary": {
    "total_time_ms": 7.158,
    "rows_sent": 100,
    "rows_examined_estimate": 3004,
    "operator_count": 6,
    "max_depth": 5
  },
  "optimizer_switches": [],
  "warnings": [
    {
      "severity": "warn",
      "category": "full_scan",
      "text": "Full table scan: users (3000 rows)",
      "source": "plan",
      "node_labels": [
        "Table scan [users]"
      ]
    }
  ],
  "suggestions": [
    {
      "severity": "high",
      "category": "index",
      "action": "Add indexes on filter/join columns to avoid full table scans",
      "source": "plan"
    }
  ],
  "executive_summary": "Query scans 1 table; examines ~3,004 rows to return 100 in 7.2 ms. Main finding: full scan of users (3,000 rows).",
  "plan_tree": {
    "node_id": "n:983802d67230",
    "short_label": "Limit: 100 rows",
    "folded_label": "LIMIT starts=1 rows=100",
    "children": [
      {
        "node_id": "n:bfdf634d1124",
        "short_label": "Table scan [<temporary>]",
        "folded_label": "TABLE SCAN [<temporary>] starts=1 rows=100",
        "children": [
          {
            "node_id": "n:9025b5024c23",
            "short_label": "Aggregate",
            "folded_label": "AGGREGATE starts=1 rows=3000",
            "children": [
              {
                "node_id": "n:80b117fc3cee",
                "short_label": "Nested loop left join",
                "folded_label": "NESTED LOOP LEFT starts=1 rows=12000",
                "children": [
                  {
                    "node_id": "n:120d6ee6f2aa",
                    "short_label": "Table scan [users]",
                    "folded_label": "TABLE SCAN [users] starts=1 rows=3000",
                    "children": []
                  },
                  {
                    "node_id": "n:ee6d8ad2a70f",
                    "short_label": "Covering index [orders.idx_user]",
                    "folded_label": "COVERING INDEX [orders.idx_user] starts=3000 rows=4",
                    "children": []
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  "query": {
    "raw": "/* select#1 */ select `u`.`id` AS `id`,`u`.`name` AS `name`,count(`o`.`id`) AS `order_count` from `testdb`.`users` `u` left join `testdb`.`orders` `o` on((`o`.`user_id` = `u`.`id`)) where true group by `testdb`.`u`.`id`,`testdb`.`u`.`name` limit 100",
    "beautified": "select u.id AS id,u.name AS name,count(o.id) AS order_count\nfrom testdb.users u\nleft\n  join testdb.orders o on((o.user_id = u.id))\nwhere true\ngroup by testdb.u.id,testdb.u.name\nlimit 100"
  },
  "primary_action": {
    "ref": "suggestions[0]"
  },
  "teach_hooks": [
    {
      "lesson": "full_scan",
      "match": {
        "folded_label": "TABLE SCAN [<temporary>] starts=1 rows=100",
        "short_label": "Table scan [<temporary>]"
      },
      "controls": {
        "rows": 100,
        "row_size": 200,
        "selectivity": 100.0
      },
      "note": "Table scan on <temporary> (<temporary>)",
      "query_sql": "/* select#1 */ select `u`.`id` AS `id`,`u`.`name` AS `name`,count(`o`.`id`) AS `order_count` from `testdb`.`users` `u` left join `testdb`.`orders` `o` on((`o`.`user_id` = `u`.`id`)) where true group by `testdb`.`u`.`id`,`testdb`.`u`.`name` limit 100"
    },
    {
      "lesson": "tmp",
      "match": {
        "folded_label": "AGGREGATE starts=1 rows=3000",
        "short_label": "Aggregate"
      },
      "controls": {
        "rows": 3000,
        "row_size": 200
      },
      "note": "Aggregate using temporary table",
      "query_sql": "/* select#1 */ select `u`.`id` AS `id`,`u`.`name` AS `name`,count(`o`.`id`) AS `order_count` from `testdb`.`users` `u` left join `testdb`.`orders` `o` on((`o`.`user_id` = `u`.`id`)) where true group by `testdb`.`u`.`id`,`testdb`.`u`.`name` limit 100"
    },
    {
      "lesson": "nested_loop",
      "match": {
        "folded_label": "NESTED LOOP LEFT starts=1 rows=12000",
        "short_label": "Nested loop left join"
      },
      "controls": {
        "outer_rows": 3000,
        "inner_rows": 12000,
        "row_size": 200
      },
      "note": "Nested loop left join",
      "query_sql": "/* select#1 */ select `u`.`id` AS `id`,`u`.`name` AS `name`,count(`o`.`id`) AS `order_count` from `testdb`.`users` `u` left join `testdb`.`orders` `o` on((`o`.`user_id` = `u`.`id`)) where true group by `testdb`.`u`.`id`,`testdb`.`u`.`name` limit 100"
    },
    {
      "lesson": "full_scan",
      "match": {
        "folded_label": "TABLE SCAN [users] starts=1 rows=3000",
        "short_label": "Table scan [users]"
      },
      "controls": {
        "rows": 3000,
        "row_size": 200,
        "selectivity": 100.0
      },
      "note": "Table scan on u (users)",
      "query_sql": "/* select#1 */ select `u`.`id` AS `id`,`u`.`name` AS `name`,count(`o`.`id`) AS `order_count` from `testdb`.`users` `u` left join `testdb`.`orders` `o` on((`o`.`user_id` = `u`.`id`)) where true group by `testdb`.`u`.`id`,`testdb`.`u`.`name` limit 100"
    },
    {
      "lesson": "non_unique_lookup",
      "match": {
        "folded_label": "COVERING INDEX [orders.idx_user] starts=3000 rows=4",
        "short_label": "Covering index [orders.idx_user]"
      },
      "controls": {
        "rows": 12000,
        "selectivity": 40.0,
        "covering": true
      },
      "note": "Covering index lookup on o using idx_user (user_id=u.id) (orders)",
      "query_sql": "/* select#1 */ select `u`.`id` AS `id`,`u`.`name` AS `name`,count(`o`.`id`) AS `order_count` from `testdb`.`users` `u` left join `testdb`.`orders` `o` on((`o`.`user_id` = `u`.`id`)) where true group by `testdb`.`u`.`id`,`testdb`.`u`.`name` limit 100"
    }
  ],
  "operator_complexities": [
    {
      "node_id": "n:bfdf634d1124",
      "folded_label": "TABLE SCAN [<temporary>] starts=1 rows=100",
      "short_label": "Table scan [<temporary>]",
      "complexity": {
        "big_o": "O(n)",
        "short": "n",
        "severity": "medium",
        "rationale": "Full table scan: the storage engine returns every row; cost scales with the table size.",
        "confidence": "exact",
        "learn_more": "full_table_scan"
      }
    },
    {
      "node_id": "n:80b117fc3cee",
      "folded_label": "NESTED LOOP LEFT starts=1 rows=12000",
      "short_label": "Nested loop left join",
      "complexity": {
        "big_o": "O(n · log m)",
        "short": "n · log m",
        "severity": "medium",
        "rationale": "Indexed nested loop: each outer row probes the inner table via an index descent.",
        "confidence": "exact",
        "learn_more": "nested_loop_join"
      }
    },
    {
      "node_id": "n:120d6ee6f2aa",
      "folded_label": "TABLE SCAN [users] starts=1 rows=3000",
      "short_label": "Table scan [users]",
      "complexity": {
        "big_o": "O(n)",
        "short": "n",
        "severity": "medium",
        "rationale": "Full table scan: the storage engine returns every row; cost scales with the table size.",
        "confidence": "exact",
        "learn_more": "full_table_scan"
      }
    },
    {
      "node_id": "n:ee6d8ad2a70f",
      "folded_label": "COVERING INDEX [orders.idx_user] starts=3000 rows=4",
      "short_label": "Covering index [orders.idx_user]",
      "complexity": {
        "big_o": "O(log n + k)",
        "short": "log n + k",
        "severity": "good",
        "rationale": "Index lookup (ref): one B+tree descent then a sequential walk over k matching index entries. k = matching rows for the indexed predicate.",
        "confidence": "exact",
        "learn_more": "index_lookup"
      }
    }
  ]
}

Teach: Operator deep dive