Summary
Query runs 6 operators; returns 50 rows in 0.18 ms. No warnings.
- Total time
- 177 µs
- Rows returned
- 50
- Rows examined
- 11
- Operators
- 6
No blocking issues found
myflames found nothing to fix in this plan — it looks healthy.
SQL
select u.name AS name,o.id AS id,oi.product_id AS product_id
from testdb.users u
join testdb.orders o
join testdb.order_items oi
where ((o.user_id = u.id) and (oi.order_id = o.id) and (u.country = 'JP'))
limit 50
Execution plan (workbench)
Click a plan operator to inspect details.
Agent-ready · token savings
Feeding this plan to an AI as the myflames digest instead of raw EXPLAIN JSON cuts the prompt by 8.4× (88.1% fewer tokens).
- Raw plan
- 1,212 tokens
- myflames digest
- 144 tokens
- Saved
- 1,068 tokens
- Per 1,000 queries
- ~$3.20 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:
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": 0.177,
"rows_sent": 50,
"rows_examined_estimate": 11,
"operator_count": 6,
"max_depth": 4
},
"optimizer_switches": [
{
"name": "index_condition_pushdown",
"value": "on",
"explanation": "Parts of the WHERE clause are evaluated inside the storage engine using index columns before fetching the full row — reduces rows handed to the server layer.",
"node_labels": [
"Index lookup [users.idx_country]"
]
}
],
"warnings": [],
"suggestions": [],
"executive_summary": "Query runs 6 operators; returns 50 rows in 0.18 ms. No warnings.",
"plan_tree": {
"node_id": "n:91695df69435",
"short_label": "Limit: 50 rows",
"folded_label": "LIMIT starts=1 rows=50",
"children": [
{
"node_id": "n:49e726cff524",
"short_label": "Nested loop inner join",
"folded_label": "NESTED LOOP INNER starts=1 rows=50",
"children": [
{
"node_id": "n:01ebcf83417b",
"short_label": "Nested loop inner join",
"folded_label": "NESTED LOOP INNER starts=1 rows=21",
"children": [
{
"node_id": "n:ef02109b74d9",
"short_label": "Index lookup [users.idx_country]",
"folded_label": "INDEX LOOKUP [users.idx_country] starts=1 rows=6",
"children": []
},
{
"node_id": "n:4a77f54e91dd",
"short_label": "Covering index [orders.idx_user]",
"folded_label": "COVERING INDEX [orders.idx_user] starts=6 rows=4",
"children": []
}
]
},
{
"node_id": "n:7919cbd1ee85",
"short_label": "Index lookup [order_items.idx_order]",
"folded_label": "INDEX LOOKUP [order_items.idx_order] starts=21 rows=2",
"children": []
}
]
}
]
},
"query": {
"raw": "/* select#1 */ select `u`.`name` AS `name`,`o`.`id` AS `id`,`oi`.`product_id` AS `product_id` from `testdb`.`users` `u` join `testdb`.`orders` `o` join `testdb`.`order_items` `oi` where ((`o`.`user_id` = `u`.`id`) and (`oi`.`order_id` = `o`.`id`) and (`u`.`country` = 'JP')) limit 50",
"beautified": "select u.name AS name,o.id AS id,oi.product_id AS product_id\nfrom testdb.users u\n join testdb.orders o\n join testdb.order_items oi\nwhere ((o.user_id = u.id) and (oi.order_id = o.id) and (u.country = 'JP'))\nlimit 50"
},
"teach_hooks": [
{
"lesson": "nested_loop",
"match": {
"folded_label": "NESTED LOOP INNER starts=1 rows=50",
"short_label": "Nested loop inner join"
},
"controls": {
"outer_rows": 21,
"inner_rows": 50,
"row_size": 200
},
"note": "Nested loop inner join",
"query_sql": "/* select#1 */ select `u`.`name` AS `name`,`o`.`id` AS `id`,`oi`.`product_id` AS `product_id` from `testdb`.`users` `u` join `testdb`.`orders` `o` join `testdb`.`order_items` `oi` where ((`o`.`user_id` = `u`.`id`) and (`oi`.`order_id` = `o`.`id`) and (`u`.`country` = 'JP')) limit 50"
},
{
"lesson": "nested_loop",
"match": {
"folded_label": "NESTED LOOP INNER starts=1 rows=21",
"short_label": "Nested loop inner join"
},
"controls": {
"outer_rows": 6,
"inner_rows": 21,
"row_size": 200
},
"note": "Nested loop inner join",
"query_sql": "/* select#1 */ select `u`.`name` AS `name`,`o`.`id` AS `id`,`oi`.`product_id` AS `product_id` from `testdb`.`users` `u` join `testdb`.`orders` `o` join `testdb`.`order_items` `oi` where ((`o`.`user_id` = `u`.`id`) and (`oi`.`order_id` = `o`.`id`) and (`u`.`country` = 'JP')) limit 50"
},
{
"lesson": "non_unique_lookup",
"match": {
"folded_label": "INDEX LOOKUP [users.idx_country] starts=1 rows=6",
"short_label": "Index lookup [users.idx_country]"
},
"controls": {
"rows": 6,
"selectivity": 1.0,
"covering": false
},
"note": "Index lookup on u using idx_country (country='JP'), with index condition: (u.country = 'JP') (users)",
"query_sql": "/* select#1 */ select `u`.`name` AS `name`,`o`.`id` AS `id`,`oi`.`product_id` AS `product_id` from `testdb`.`users` `u` join `testdb`.`orders` `o` join `testdb`.`order_items` `oi` where ((`o`.`user_id` = `u`.`id`) and (`oi`.`order_id` = `o`.`id`) and (`u`.`country` = 'JP')) limit 50"
},
{
"lesson": "non_unique_lookup",
"match": {
"folded_label": "COVERING INDEX [orders.idx_user] starts=6 rows=4",
"short_label": "Covering index [orders.idx_user]"
},
"controls": {
"rows": 21,
"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`.`name` AS `name`,`o`.`id` AS `id`,`oi`.`product_id` AS `product_id` from `testdb`.`users` `u` join `testdb`.`orders` `o` join `testdb`.`order_items` `oi` where ((`o`.`user_id` = `u`.`id`) and (`oi`.`order_id` = `o`.`id`) and (`u`.`country` = 'JP')) limit 50"
},
{
"lesson": "non_unique_lookup",
"match": {
"folded_label": "INDEX LOOKUP [order_items.idx_order] starts=21 rows=2",
"short_label": "Index lookup [order_items.idx_order]"
},
"controls": {
"rows": 50,
"selectivity": 23.5,
"covering": false
},
"note": "Index lookup on oi using idx_order (order_id=o.id) (order_items)",
"query_sql": "/* select#1 */ select `u`.`name` AS `name`,`o`.`id` AS `id`,`oi`.`product_id` AS `product_id` from `testdb`.`users` `u` join `testdb`.`orders` `o` join `testdb`.`order_items` `oi` where ((`o`.`user_id` = `u`.`id`) and (`oi`.`order_id` = `o`.`id`) and (`u`.`country` = 'JP')) limit 50"
}
],
"operator_complexities": [
{
"node_id": "n:49e726cff524",
"folded_label": "NESTED LOOP INNER starts=1 rows=50",
"short_label": "Nested loop inner 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:01ebcf83417b",
"folded_label": "NESTED LOOP INNER starts=1 rows=21",
"short_label": "Nested loop inner 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:ef02109b74d9",
"folded_label": "INDEX LOOKUP [users.idx_country] starts=1 rows=6",
"short_label": "Index lookup [users.idx_country]",
"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"
}
},
{
"node_id": "n:4a77f54e91dd",
"folded_label": "COVERING INDEX [orders.idx_user] starts=6 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"
}
},
{
"node_id": "n:7919cbd1ee85",
"folded_label": "INDEX LOOKUP [order_items.idx_order] starts=21 rows=2",
"short_label": "Index lookup [order_items.idx_order]",
"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"
}
}
]
}