Explain and cost

Explain output shows the work that a call completed. The example executes the names query with an explain record and reads its completed stages.

Example

Explain a query

query_text holds this document:

TRON165 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
045C 3F6E616D65txt "?name"
0A0E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
172C 3F65txt "?e"
1A4C 6E616D65txt "name"
1F5C 3F6E616D65txt "?name"
250E 15 00 0700 030000 00 17000000 1A0000 00 1F000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @17 → @1A → @1F
3A0E 0D 00 0100 010000 00 25000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @25
475C 3F6E616D65txt "?name"
4D0E 0D 00 0100 010000 00 47000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @47
5A5C 7768657265txt "where"
600F 0A 5A000000 3A00 0000map leaf, size 10: @5A → @3A
6A4C 66696E64txt "find"
6F0F 0A 6A000000 0A00 0000map leaf, size 10: @6A → @A
797C 6F726465724279txt "orderBy"
810F 0A 79000000 4D00 0000map leaf, size 10: @79 → @4D
8B07 12 2A000000 6000 0000 6F000000 8100 0000map branch, size 18, depth 0 (root), slots 1, 3, 5: @60 → @6F → @81
python198 B
explain = stardust.QueryExplain()
async with (await stardust.parse(query_text, "tron")) as definition, (await db.query(definition)) as query, (await query.run(explain=explain)):
    result = explain
TRON1.1 kB
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
004BC 6172656E615F62 79746573txt "arena_bytes"
01002 90060000000000 00i64 1680
0190F 0A 04000000 1000 0000map leaf, size 10: @4 → @10
0233C 637075txt "cpu"
02702 34080000000000 00i64 2100
0300F 0A 23000000 2700 0000map leaf, size 10: @23 → @27
03A4C 77616C6Ctxt "wall"
03F02 B6080000000000 00i64 2230
0480F 0A 3A000000 3F00 0000map leaf, size 10: @3A → @3F
05207 12 21800000 1900 0000 30000000 4800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @19 → @30 → @48
064BC 6172656E615F62 79746573txt "arena_bytes"
07002 00000000000000 00i64 0
0790F 0A 64000000 7000 0000map leaf, size 10: @64 → @70
0833C 637075txt "cpu"
08702 00000000000000 00i64 0
0900F 0A 83000000 8700 0000map leaf, size 10: @83 → @87
09A4C 77616C6Ctxt "wall"
09F02 00000000000000 00i64 0
0A80F 0A 9A000000 9F00 0000map leaf, size 10: @9A → @9F
0B207 12 21800000 7900 0000 90000000 A800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @79 → @90 → @A8
0C4BC 6172656E615F62 79746573txt "arena_bytes"
0D002 001D0000000000 00i64 7424
0D90F 0A C4000000 D000 0000map leaf, size 10: @C4 → @D0
0E33C 637075txt "cpu"
0E702 1E230000000000 00i64 8990
0F00F 0A E3000000 E700 0000map leaf, size 10: @E3 → @E7
0FA4C 77616C6Ctxt "wall"
0FF02 3C230000000000 00i64 9020
1080F 0A FA000000 FF00 0000map leaf, size 10: @FA → @FF
11207 12 21800000 D900 0000 F0000000 0801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @D9 → @F0 → @108
124BC 6172656E615F62 79746573txt "arena_bytes"
Show all 106 nodes
Offset (hex)Bytes (hex)Meaning
13002 90230000000000 00i64 9104
1390F 0A 24010000 3001 0000map leaf, size 10: @124 → @130
1433C 637075txt "cpu"
14702 842B0000000000 00i64 11140
1500F 0A 43010000 4701 0000map leaf, size 10: @143 → @147
15A4C 77616C6Ctxt "wall"
15F02 2E2C0000000000 00i64 11310
1680F 0A 5A010000 5F01 0000map leaf, size 10: @15A → @15F
17207 12 21800000 3901 0000 50010000 6801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @139 → @150 → @168
1847C 65786563757465txt "execute"
18C02 00000000000000 00i64 0
1950F 0A 84010000 8C01 0000map leaf, size 10: @184 → @18C
19F4C 726F7773txt "rows"
1A402 03000000000000 00i64 3
1AD0F 0A 9F010000 A401 0000map leaf, size 10: @19F → @1A4
1B74C 706C616Etxt "plan"
1BC02 26020000000000 00i64 550
1C50F 0A B7010000 BC01 0000map leaf, size 10: @1B7 → @1BC
1CF3C 72756Etxt "run"
1D30F 0A CF010000 1201 0000map leaf, size 10: @1CF → @112
1DD07 12 01840000 AD01 0000 C5010000 D301 0000map branch, size 18, depth 1, slots 0, 10, 15: @1AD → @1C5 → @1D3
1EF5C 67726F7570txt "group"
1F502 00000000000000 00i64 0
1FE0F 0A EF010000 F501 0000map leaf, size 10: @1EF → @1F5
2087C 636F6D70696C65txt "compile"
21002 9A010000000000 00i64 410
2190F 0A 08020000 1002 0000map leaf, size 10: @208 → @210
223AC 706172616D6574 657273txt "parameters"
22E0F 0A 23020000 B200 0000map leaf, size 10: @223 → @B2
23814 10 737461676573 5F636F6D706C6574 6564txt "stages_completed"
24A02 03000000000000 00i64 3
2530F 0A 38020000 4A02 0000map leaf, size 10: @238 → @24A
25D5C 6F72646572txt "order"
26302 00000000000000 00i64 0
26C0F 0A 5D020000 6302 0000map leaf, size 10: @25D → @263
27607 0E C0000000 5302 0000 6C020000map branch, size 14, depth 1, slots 6, 7: @253 → @26C
284EC 6172656E615F63 61706163697479txt "arena_capacity"
29302 00004000000000 00i64 4194304
29C0F 0A 84020000 9302 0000map leaf, size 10: @284 → @293
2A614 11 627564676574 5F757365645F6279 746573txt "budget_used_bytes"
2B902 D2270000000000 00i64 10194
2C20F 0A A6020000 B902 0000map leaf, size 10: @2A6 → @2B9
2CC07 0E 24000000 9C02 0000 C2020000map branch, size 14, depth 1, slots 2, 5: @29C → @2C2
2DAFC 6275646765745F 7265667573616C73txt "budget_refusals"
2EA02 00000000000000 00i64 0
2F30F 0A DA020000 EA02 0000map leaf, size 10: @2DA → @2EA
2FD4C 776F726Btxt "work"
30202 F8160000000000 00i64 5880
30B0F 0A FD020000 0203 0000map leaf, size 10: @2FD → @302
31507 0E 88000000 F302 0000 0B030000map branch, size 14, depth 1, slots 3, 7: @2F3 → @30B
323FC 6D656D6F72795F 7265667573616C73txt "memory_refusals"
33302 00000000000000 00i64 0
33C0F 0A 23030000 3303 0000map leaf, size 10: @323 → @333
346CC 6275646765745F 6279746573txt "budget_bytes"
35302 00823E71020000 00i64 10489856512
35C0F 0A 46030000 5303 0000map leaf, size 10: @346 → @353
3665C 746F74616Ctxt "total"
36C0F 0A 66030000 7201 0000map leaf, size 10: @366 → @172
37614 11 627564676574 5F7065616B5F6279 746573txt "budget_peak_bytes"
38902 542F0000000000 00i64 12116
3920F 0A 76030000 8903 0000map leaf, size 10: @376 → @389
39C07 16 13040000 3C03 0000 5C030000 6C03 0000 92030000map branch, size 22, depth 1, slots 0, 1, 4, 10: @33C → @35C → @36C → @392
3B25C 7265747279txt "retry"
3B802 00000000000000 00i64 0
3C10F 0A B2030000 B803 0000map leaf, size 10: @3B2 → @3B8
3CB7C 72657472696573txt "retries"
3D302 00000000000000 00i64 0
3DC0F 0A CB030000 D303 0000map leaf, size 10: @3CB → @3D3
3E6CC 6D656D6F72795F 6279746573txt "memory_bytes"
3F302 6B170000000000 00i64 5995
3FC0F 0A E6030000 F303 0000map leaf, size 10: @3E6 → @3F3
406FC 6C6F61645F6465 66696E6974696F6Etxt "load_definition"
4160F 0A 06040000 5200 0000map leaf, size 10: @406 → @52
42007 0E 01100000 FC03 0000 16040000map branch, size 14, depth 1, slots 0, 12: @3FC → @416
42E07 36 FBDA0000 9501 0000 DD010000 FE01 0000 19020000 2E02 0000 76020000 CC02 0000 15030000 9C03 0000 C1030000 DC03 0000 20040000map branch, size 54, depth 0 (root), slots 0, 1, 3, 4, 5, 6, 7, 9, 11, 12, 14, 15: @195 → @1DD → @1FE → @219 → @22E → @276 → @2CC → @315 → @39C → @3C1 → @3DC → @420
Offset (hex)Bytes (hex)Meaning

Failure output

A failed call can still supply explain output for the stages that completed.

  1. Read stages_completed.
  2. Then read the fields of the stages that completed.

The record tables below give the fields, absent values, and time units of each operation.

Stored plan decisions

A call's cost record describes that execution. It does not load stored plan history. Use the plan operation in Definitions with the explain action to read accepted plans and their history. Each revision reports its version, source and reason. Trial decisions include candidate proposals and measured verdicts.

Set page_size and max_bytes to bound one diagnostic response. The response includes the current accepted transaction, the complete plan state and a history page from one snapshot. Pass a nonzero next_after as the next page's argument.

The adaptive query planner can retry a capped plan with the statistics plan. Query explain reports those attempts in retry and retries.

cost

This record measures one explain stage. The cpu and wall fields are durations. The ABI gives 100-ns ticks. Thus, a time less than one tick is zero.

FieldTypeUnitRangeAbsentMeaning
cputimedelta | NoneHost duration (100 ns ticks at the ABI)Tick rangeNoneThread CPU time. The call measures this value. Independent calls can differ.
walltimedeltaHost duration (100 ns ticks at the ABI)Tick range—Wall time. The call measures this value. Independent calls can differ.
arena_bytesintBytesHost type range—Bytes the stage allocated from the scratch arena of the call. Heap-owned outputs and the LuaJIT heap are not included. The call measures this value. Independent calls can differ.

build_explain

This record contains explain output for build.

FieldTypeUnitMeaning
prepare_expressionCostNone—
compileCostNone—
totalCostNoneThe cost of all stages. arena_bytes records the peak scratch-arena allocation.
arena_capacityintBytesBytes the scratch arena reserved. The call measures this value. Independent calls can differ.
stages_completedintCountStages that ran.
cache_hitboolNoneThe leased runtime holds a compiled copy of the expression. The call measures this value. Independent calls can differ.

eval_explain

This record contains explain output for evaluate.

FieldTypeUnitMeaning
prepare_variablesCostNone—
evaluateCostNone—
adopt_documentCostNone—
totalCostNoneThe cost of all stages. arena_bytes records the peak scratch-arena allocation.
arena_capacityintBytesBytes the scratch arena reserved. The call measures this value. Independent calls can differ.
document_bytesintBytesUsed bytes of the native value, string and source buffers of the result. The call measures this value. Independent calls can differ.
stages_completedintCountStages that ran.

query_explain

This record contains explain output for query run. The compile, plan, execute, group and order fields divide the wall time of run into stages.

FieldTypeUnitRangeMeaning
load_definitionCostNoneHost type range—
parametersCostNoneHost type range—
runCostNoneHost type rangePlanning, execution and aggregation. Pages render later, in next.
totalCostNoneHost type rangeThe cost of all stages. arena_bytes records the peak scratch-arena allocation.
arena_capacityintBytesHost type rangeBytes the scratch arena reserved. The call measures this value. Independent calls can differ.
worktimedeltaHost duration (100 ns ticks at the ABI)Tick rangeThread CPU duration consumed by the query. The call measures this value. Independent calls can differ.
rowsintCountHost type rangeResult rows.
compiletimedeltaHost duration (100 ns ticks at the ABI)Tick rangeThe call measures this value. Independent calls can differ.
plantimedeltaHost duration (100 ns ticks at the ABI)Tick rangeThe call measures this value. Independent calls can differ.
executetimedeltaHost duration (100 ns ticks at the ABI)Tick rangeProduction of solutions. A streamed result produces solutions while pages render. Thus, execute measures only the solutions that run reads. The call measures this value. Independent calls can differ.
grouptimedeltaHost duration (100 ns ticks at the ABI)Tick rangeAggregates, windows and computed columns. The call measures this value. Independent calls can differ.
ordertimedeltaHost duration (100 ns ticks at the ABI)Tick rangeThe call measures this value. Independent calls can differ.
memory_bytesintBytesHost type rangeThe most working memory the run held reserved in the database's memory budget at once. The call measures this value. Independent calls can differ.
memory_refusalsintCountHost type rangeReservations of the run that the memory budget granted less than asked. The call measures this value. Independent calls can differ.
budget_bytesintBytesHost type rangeThe database's memory budget (memory_budget_bytes).
budget_used_bytesintBytesHost type rangeBytes every query of the database held reserved when run returned. The call measures this value. Independent calls can differ.
budget_peak_bytesintBytesHost type rangeThe most bytes the database's queries held reserved at once since it opened. The call measures this value. Independent calls can differ.
budget_refusalsintCountHost type rangeReservations the database's budget granted less than asked since it opened. The call measures this value. Independent calls can differ.
retrytimedeltaHost duration (100 ns ticks at the ABI)Tick rangeThread CPU duration of the attempts given up because the planner's plan passed its cap. work includes it. The call measures this value. Independent calls can differ.
stages_completedintCountHost type rangeStages that ran.
retriesintCountHost type rangeAttempts given up because the planner's plan passed its cap; the query then ran the statistics' plan within the rest of its budget.

mutation_explain

This record contains explain output for mutation run.

FieldTypeUnitMeaning
load_definitionCostNone—
parametersCostNone—
runCostNone—
totalCostNoneThe cost of all stages. arena_bytes records the peak scratch-arena allocation.
arena_capacityintBytesBytes the scratch arena reserved. The call measures this value. Independent calls can differ.
stages_completedintCountStages that ran.
attemptsintCountEvaluations. More than one when a concurrent write forced a retry.

patch_explain

This record contains explain output for merge_patch.

FieldTypeUnitMeaning
copy_patchCostNone—
commitCostNoneValidation and the commit.
totalCostNoneThe cost of all stages. arena_bytes records the peak scratch-arena allocation.
arena_capacityintBytesBytes the scratch arena reserved. The call measures this value. Independent calls can differ.
stages_completedintCountStages that ran.

Explain examples

The generator captured each result from the native library.

Inspect one measured cost stage

expression_text holds this document:

TRON47 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 2Btxt "+"
062C 3F78txt "?x"
0902 01000000000000 00i64 1
120E 15 00 0700 030000 00 04000000 060000 00 09000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @6 → @9
python179 B
explain = stardust.BuildExplain()
async with (await stardust.parse(expression_text, "tron")) as expression, (await stardust.build(expression, explain)):
    result = explain.total
TRON108 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
04BC 6172656E615F62 79746573txt "arena_bytes"
1002 00000000000000 00i64 0
190F 0A 04000000 1000 0000map leaf, size 10: @4 → @10
233C 637075txt "cpu"
2702 46000000000000 00i64 70
300F 0A 23000000 2700 0000map leaf, size 10: @23 → @27
3A4C 77616C6Ctxt "wall"
3F02 50000000000000 00i64 80
480F 0A 3A000000 3F00 0000map leaf, size 10: @3A → @3F
5207 12 21800000 1900 0000 30000000 4800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @19 → @30 → @48

Explain expression compilation

expression_text holds this document:

TRON47 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 2Btxt "+"
062C 3F78txt "?x"
0902 01000000000000 00i64 1
120E 15 00 0700 030000 00 04000000 060000 00 09000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @6 → @9
python173 B
explain = stardust.BuildExplain()
async with (await stardust.parse(expression_text, "tron")) as expression, (await stardust.build(expression, explain)):
    result = explain
TRON486 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
004BC 6172656E615F62 79746573txt "arena_bytes"
01002 00000000000000 00i64 0
0190F 0A 04000000 1000 0000map leaf, size 10: @4 → @10
0233C 637075txt "cpu"
02702 00000000000000 00i64 0
0300F 0A 23000000 2700 0000map leaf, size 10: @23 → @27
03A4C 77616C6Ctxt "wall"
03F02 0A000000000000 00i64 10
0480F 0A 3A000000 3F00 0000map leaf, size 10: @3A → @3F
05207 12 21800000 1900 0000 30000000 4800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @19 → @30 → @48
064BC 6172656E615F62 79746573txt "arena_bytes"
07002 00000000000000 00i64 0
0790F 0A 64000000 7000 0000map leaf, size 10: @64 → @70
0833C 637075txt "cpu"
08702 28000000000000 00i64 40
0900F 0A 83000000 8700 0000map leaf, size 10: @83 → @87
09A4C 77616C6Ctxt "wall"
09F02 28000000000000 00i64 40
0A80F 0A 9A000000 9F00 0000map leaf, size 10: @9A → @9F
0B207 12 21800000 7900 0000 90000000 A800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @79 → @90 → @A8
0C4BC 6172656E615F62 79746573txt "arena_bytes"
0D002 00000000000000 00i64 0
0D90F 0A C4000000 D000 0000map leaf, size 10: @C4 → @D0
0E33C 637075txt "cpu"
0E702 32000000000000 00i64 50
0F00F 0A E3000000 E700 0000map leaf, size 10: @E3 → @E7
0FA4C 77616C6Ctxt "wall"
0FF02 3C000000000000 00i64 60
1080F 0A FA000000 FF00 0000map leaf, size 10: @FA → @FF
11207 12 21800000 D900 0000 F0000000 0801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @D9 → @F0 → @108
12414 12 707265706172 655F657870726573 73696F6Etxt "prepare_expression"
1380F 0A 24010000 5200 0000map leaf, size 10: @124 → @52
1427C 636F6D70696C65txt "compile"
14A0F 0A 42010000 B200 0000map leaf, size 10: @142 → @B2
15414 10 737461676573 5F636F6D706C6574 6564txt "stages_completed"
16602 02000000000000 00i64 2
16F0F 0A 54010000 6601 0000map leaf, size 10: @154 → @166
179EC 6172656E615F63 61706163697479txt "arena_capacity"
18802 00000100000000 00i64 65536
1910F 0A 79010000 8801 0000map leaf, size 10: @179 → @188
19B5C 746F74616Ctxt "total"
1A10F 0A 9B010000 1201 0000map leaf, size 10: @19B → @112
1AB9C 63616368655F68 6974txt "cache_hit"
1B509bit true
1B60F 0A AB010000 B501 0000map leaf, size 10: @1AB → @1B5
1C007 1E D2480000 3801 0000 4A010000 6F01 0000 91010000 A101 0000 B6010000map branch, size 30, depth 0 (root), slots 1, 4, 6, 7, 11, 14: @138 → @14A → @16F → @191 → @1A1 → @1B6

Explain patch validation and commit

seed_text holds this document:

TRON449 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0043C 616765txt "age"
00802 24000000000000 00i64 36
0110F 0A 04000000 0800 0000map leaf, size 10: @4 → @8
01B4C 726F6C65txt "role"
0208C 656E67696E6565 72txt "engineer"
0290F 0A 1B000000 2000 0000map leaf, size 10: @1B → @20
0334C 6E616D65txt "name"
0383C 416461txt "Ada"
03C0F 0A 33000000 3800 0000map leaf, size 10: @33 → @38
04607 12 00910000 1100 0000 29000000 3C00 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @11 → @29 → @3C
0585C 236C696E6Btxt "#link"
05E5C 235F616461txt "#_ada"
0640F 0A 58000000 5E00 0000map leaf, size 10: @58 → @5E
06E3C 616765txt "age"
07202 29000000000000 00i64 41
07B0F 0A 6E000000 7200 0000map leaf, size 10: @6E → @72
0856C 6D656E746F72txt "mentor"
08C0F 0A 85000000 6400 0000map leaf, size 10: @85 → @64
0964C 726F6C65txt "role"
09B8C 656E67696E6565 72txt "engineer"
0A40F 0A 96000000 9B00 0000map leaf, size 10: @96 → @9B
0AE4C 6E616D65txt "name"
0B33C 426F62txt "Bob"
0B70F 0A AE000000 B300 0000map leaf, size 10: @AE → @B3
0C107 16 00990000 7B00 0000 8C000000 A400 0000 B7000000map branch, size 22, depth 0 (root), slots 8, 11, 12, 15: @7B → @8C → @A4 → @B7
0D73C 616765txt "age"
0DB02 1D000000000000 00i64 29
0E40F 0A D7000000 DB00 0000map leaf, size 10: @D7 → @DB
0EE4C 726F6C65txt "role"
0F38C 64657369676E65 72txt "designer"
0FC0F 0A EE000000 F300 0000map leaf, size 10: @EE → @F3
1064C 6E616D65txt "name"
10B2C 4379txt "Cy"
10E0F 0A 06010000 0B01 0000map leaf, size 10: @106 → @10B
11807 12 00910000 E400 0000 FC000000 0E01 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @E4 → @FC → @10E
12A6C 617574686F72txt "author"
1315C 736D6F6B65txt "smoke"
1370F 0A 2A010000 3101 0000map leaf, size 10: @12A → @131
1416C 726561736F6Etxt "reason"
1484C 73656564txt "seed"
14D0F 0A 41010000 4801 0000map leaf, size 10: @141 → @148
15707 0E 40080000 3701 0000 4D010000map branch, size 14, depth 0 (root), slots 6, 11: @137 → @14D
1654C 235F7478txt "#_tx"
16A0F 0A 65010000 5701 0000map leaf, size 10: @165 → @157
1744C 235F6379txt "#_cy"
1790F 0A 74010000 1801 0000map leaf, size 10: @174 → @118
1835C 235F626F62txt "#_bob"
1890F 0A 83010000 C100 0000map leaf, size 10: @183 → @C1
1935C 235F616461txt "#_ada"
1990F 0A 93010000 4600 0000map leaf, size 10: @193 → @46
1A307 16 88210000 6A01 0000 79010000 8901 0000 99010000map branch, size 22, depth 0 (root), slots 3, 7, 8, 13: @16A → @179 → @189 → @199
python154 B
explain = stardust.PatchExplain()
async with (await stardust.parse(seed_text, "tron")) as seed:
    (await db.merge_patch(seed, explain))
result = explain
TRON461 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
004BC 6172656E615F62 79746573txt "arena_bytes"
01002 180C0000000000 00i64 3096
0190F 0A 04000000 1000 0000map leaf, size 10: @4 → @10
0233C 637075txt "cpu"
02702 48080000000000 00i64 2120
0300F 0A 23000000 2700 0000map leaf, size 10: @23 → @27
03A4C 77616C6Ctxt "wall"
03F02 5C080000000000 00i64 2140
0480F 0A 3A000000 3F00 0000map leaf, size 10: @3A → @3F
05207 12 21800000 1900 0000 30000000 4800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @19 → @30 → @48
064BC 6172656E615F62 79746573txt "arena_bytes"
07002 481F0000000000 00i64 8008
0790F 0A 64000000 7000 0000map leaf, size 10: @64 → @70
0833C 637075txt "cpu"
08702 F8020000000000 00i64 760
0900F 0A 83000000 8700 0000map leaf, size 10: @83 → @87
09A4C 77616C6Ctxt "wall"
09F02 1EB40000000000 00i64 46110
0A80F 0A 9A000000 9F00 0000map leaf, size 10: @9A → @9F
0B207 12 21800000 7900 0000 90000000 A800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @79 → @90 → @A8
0C4BC 6172656E615F62 79746573txt "arena_bytes"
0D002 6E2B0000000000 00i64 11118
0D90F 0A C4000000 D000 0000map leaf, size 10: @C4 → @D0
0E33C 637075txt "cpu"
0E702 120C0000000000 00i64 3090
0F00F 0A E3000000 E700 0000map leaf, size 10: @E3 → @E7
0FA4C 77616C6Ctxt "wall"
0FF02 56BD0000000000 00i64 48470
1080F 0A FA000000 FF00 0000map leaf, size 10: @FA → @FF
11207 12 21800000 D900 0000 F0000000 0801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @D9 → @F0 → @108
12414 10 737461676573 5F636F6D706C6574 6564txt "stages_completed"
13602 02000000000000 00i64 2
13F0F 0A 24010000 3601 0000map leaf, size 10: @124 → @136
149EC 6172656E615F63 61706163697479txt "arena_capacity"
15802 00004000000000 00i64 4194304
1610F 0A 49010000 5801 0000map leaf, size 10: @149 → @158
16B5C 746F74616Ctxt "total"
1710F 0A 6B010000 1201 0000map leaf, size 10: @16B → @112
17B6C 636F6D6D6974txt "commit"
1820F 0A 7B010000 B200 0000map leaf, size 10: @17B → @B2
18CAC 636F70795F7061 746368txt "copy_patch"
1970F 0A 8C010000 5200 0000map leaf, size 10: @18C → @52
1A107 0E 08100000 8201 0000 97010000map branch, size 14, depth 1, slots 3, 12: @182 → @197
1AF07 16 C0880000 3F01 0000 61010000 7101 0000 A1010000map branch, size 22, depth 0 (root), slots 6, 7, 11, 15: @13F → @161 → @171 → @1A1

Explain mutation execution

birthday_text holds this document:

TRON221 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
042C 3F65txt "?e"
070E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
142C 3F65txt "?e"
174C 6E616D65txt "name"
1C3C 416461txt "Ada"
200E 15 00 0700 030000 00 14000000 170000 00 1C000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @14 → @17 → @1C
350E 0D 00 0100 010000 00 20000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @20
425C 7768657265txt "where"
480F 0A 42000000 3500 0000map leaf, size 10: @42 → @35
524C 66696E64txt "find"
570F 0A 52000000 0700 0000map leaf, size 10: @52 → @7
6107 0E 0A000000 4800 0000 57000000map branch, size 14, depth 0 (root), slots 1, 3: @48 → @57
6F3C 616765txt "age"
7302 25000000000000 00i64 37
7C0F 0A 6F000000 7300 0000map leaf, size 10: @6F → @73
862C 3F65txt "?e"
890F 0A 86000000 7C00 0000map leaf, size 10: @86 → @7C
935C 7175657279txt "query"
990F 0A 93000000 6100 0000map leaf, size 10: @93 → @61
A35C 7061746368txt "patch"
A90F 0A A3000000 8900 0000map leaf, size 10: @A3 → @89
B307 0E 40020000 9900 0000 A9000000map branch, size 14, depth 2, slots 6, 9: @99 → @A9
C107 0A 01000000 B300 0000map branch, size 10, depth 1, slots 0: @B3
CB07 0A 80000000 C100 0000map branch, size 10, depth 0 (root), slots 7: @C1
python208 B
explain = stardust.MutationExplain()
async with (await stardust.parse(birthday_text, "tron")) as birthday, (await db.mutation(birthday)) as mutation:
    (await mutation.run(explain=explain))
result = explain
TRON606 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
004BC 6172656E615F62 79746573txt "arena_bytes"
01002 10090000000000 00i64 2320
0190F 0A 04000000 1000 0000map leaf, size 10: @4 → @10
0233C 637075txt "cpu"
02702 A4060000000000 00i64 1700
0300F 0A 23000000 2700 0000map leaf, size 10: @23 → @27
03A4C 77616C6Ctxt "wall"
03F02 CC060000000000 00i64 1740
0480F 0A 3A000000 3F00 0000map leaf, size 10: @3A → @3F
05207 12 21800000 1900 0000 30000000 4800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @19 → @30 → @48
064BC 6172656E615F62 79746573txt "arena_bytes"
07002 00000000000000 00i64 0
0790F 0A 64000000 7000 0000map leaf, size 10: @64 → @70
0833C 637075txt "cpu"
08702 0A000000000000 00i64 10
0900F 0A 83000000 8700 0000map leaf, size 10: @83 → @87
09A4C 77616C6Ctxt "wall"
09F02 0A000000000000 00i64 10
0A80F 0A 9A000000 9F00 0000map leaf, size 10: @9A → @9F
0B207 12 21800000 7900 0000 90000000 A800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @79 → @90 → @A8
0C4BC 6172656E615F62 79746573txt "arena_bytes"
0D002 50AB0000000000 00i64 43856
0D90F 0A C4000000 D000 0000map leaf, size 10: @C4 → @D0
0E33C 637075txt "cpu"
0E702 262A0000000000 00i64 10790
0F00F 0A E3000000 E700 0000map leaf, size 10: @E3 → @E7
0FA4C 77616C6Ctxt "wall"
0FF02 88900000000000 00i64 37000
1080F 0A FA000000 FF00 0000map leaf, size 10: @FA → @FF
11207 12 21800000 D900 0000 F0000000 0801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @D9 → @F0 → @108
124BC 6172656E615F62 79746573txt "arena_bytes"
Show all 58 nodes
Offset (hex)Bytes (hex)Meaning
13002 60B40000000000 00i64 46176
1390F 0A 24010000 3001 0000map leaf, size 10: @124 → @130
1433C 637075txt "cpu"
14702 56310000000000 00i64 12630
1500F 0A 43010000 4701 0000map leaf, size 10: @143 → @147
15A4C 77616C6Ctxt "wall"
15F02 E0970000000000 00i64 38880
1680F 0A 5A010000 5F01 0000map leaf, size 10: @15A → @15F
17207 12 21800000 3901 0000 50010000 6801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @139 → @150 → @168
1843C 72756Etxt "run"
1880F 0A 84010000 1201 0000map leaf, size 10: @184 → @112
192AC 706172616D6574 657273txt "parameters"
19D0F 0A 92010000 B200 0000map leaf, size 10: @192 → @B2
1A714 10 737461676573 5F636F6D706C6574 6564txt "stages_completed"
1B902 03000000000000 00i64 3
1C20F 0A A7010000 B901 0000map leaf, size 10: @1A7 → @1B9
1CCEC 6172656E615F63 61706163697479txt "arena_capacity"
1DB02 00004000000000 00i64 4194304
1E40F 0A CC010000 DB01 0000map leaf, size 10: @1CC → @1DB
1EE5C 746F74616Ctxt "total"
1F40F 0A EE010000 7201 0000map leaf, size 10: @1EE → @172
1FE8C 617474656D7074 73txt "attempts"
20702 01000000000000 00i64 1
2100F 0A FE010000 0702 0000map leaf, size 10: @1FE → @207
21AFC 6C6F61645F6465 66696E6974696F6Etxt "load_definition"
22A0F 0A 1A020000 5200 0000map leaf, size 10: @21A → @52
23407 22 E2A80000 8801 0000 9D010000 C201 0000 E4010000 F401 0000 10020000 2A02 0000map branch, size 34, depth 0 (root), slots 1, 5, 6, 7, 11, 13, 15: @188 → @19D → @1C2 → @1E4 → @1F4 → @210 → @22A
Offset (hex)Bytes (hex)Meaning

Explain expression evaluation

expression_text holds this document:

TRON47 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 2Btxt "+"
062C 3F78txt "?x"
0902 01000000000000 00i64 1
120E 15 00 0700 030000 00 04000000 060000 00 09000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @6 → @9

input_text holds this document:

TRON33 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 78txt "x"
0602 29000000000000 00i64 41
0F0F 0A 04000000 0600 0000map leaf, size 10: @4 → @6
python279 B
explain = stardust.EvalExplain()
async with (await stardust.parse(expression_text, "tron")) as expression, (await stardust.build(expression)) as program, \
        (await stardust.parse(input_text, "tron")) as input, (await program.evaluate(input, explain)):
    result = explain
TRON634 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
004BC 6172656E615F62 79746573txt "arena_bytes"
01002 00000000000000 00i64 0
0190F 0A 04000000 1000 0000map leaf, size 10: @4 → @10
0233C 637075txt "cpu"
02702 00000000000000 00i64 0
0300F 0A 23000000 2700 0000map leaf, size 10: @23 → @27
03A4C 77616C6Ctxt "wall"
03F02 0A000000000000 00i64 10
0480F 0A 3A000000 3F00 0000map leaf, size 10: @3A → @3F
05207 12 21800000 1900 0000 30000000 4800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @19 → @30 → @48
064BC 6172656E615F62 79746573txt "arena_bytes"
07002 00000000000000 00i64 0
0790F 0A 64000000 7000 0000map leaf, size 10: @64 → @70
0833C 637075txt "cpu"
08702 96000000000000 00i64 150
0900F 0A 83000000 8700 0000map leaf, size 10: @83 → @87
09A4C 77616C6Ctxt "wall"
09F02 96000000000000 00i64 150
0A80F 0A 9A000000 9F00 0000map leaf, size 10: @9A → @9F
0B207 12 21800000 7900 0000 90000000 A800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @79 → @90 → @A8
0C4BC 6172656E615F62 79746573txt "arena_bytes"
0D002 00000000000000 00i64 0
0D90F 0A C4000000 D000 0000map leaf, size 10: @C4 → @D0
0E33C 637075txt "cpu"
0E702 00000000000000 00i64 0
0F00F 0A E3000000 E700 0000map leaf, size 10: @E3 → @E7
0FA4C 77616C6Ctxt "wall"
0FF02 00000000000000 00i64 0
1080F 0A FA000000 FF00 0000map leaf, size 10: @FA → @FF
11207 12 21800000 D900 0000 F0000000 0801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @D9 → @F0 → @108
124BC 6172656E615F62 79746573txt "arena_bytes"
Show all 59 nodes
Offset (hex)Bytes (hex)Meaning
13002 00000000000000 00i64 0
1390F 0A 24010000 3001 0000map leaf, size 10: @124 → @130
1433C 637075txt "cpu"
14702 A0000000000000 00i64 160
1500F 0A 43010000 4701 0000map leaf, size 10: @143 → @147
15A4C 77616C6Ctxt "wall"
15F02 AA000000000000 00i64 170
1680F 0A 5A010000 5F01 0000map leaf, size 10: @15A → @15F
17207 12 21800000 3901 0000 50010000 6801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @139 → @150 → @168
184EC 646F63756D656E 745F6279746573txt "document_bytes"
19302 2A000000000000 00i64 42
19C0F 0A 84010000 9301 0000map leaf, size 10: @184 → @193
1A614 11 707265706172 655F766172696162 6C6573txt "prepare_variables"
1B90F 0A A6010000 5200 0000map leaf, size 10: @1A6 → @52
1C314 10 737461676573 5F636F6D706C6574 6564txt "stages_completed"
1D502 03000000000000 00i64 3
1DE0F 0A C3010000 D501 0000map leaf, size 10: @1C3 → @1D5
1E8EC 6172656E615F63 61706163697479txt "arena_capacity"
1F702 00000100000000 00i64 65536
2000F 0A E8010000 F701 0000map leaf, size 10: @1E8 → @1F7
20AEC 61646F70745F64 6F63756D656E74txt "adopt_document"
2190F 0A 0A020000 1201 0000map leaf, size 10: @20A → @112
22307 0E 14000000 0002 0000 19020000map branch, size 14, depth 1, slots 2, 4: @200 → @219
2318C 6576616C756174 65txt "evaluate"
23A0F 0A 31020000 B200 0000map leaf, size 10: @231 → @B2
2445C 746F74616Ctxt "total"
24A0F 0A 44020000 7201 0000map leaf, size 10: @244 → @172
25407 1E E20A0000 9C01 0000 B9010000 DE01 0000 23020000 3A02 0000 4A020000map branch, size 30, depth 0 (root), slots 1, 5, 6, 7, 9, 11: @19C → @1B9 → @1DE → @223 → @23A → @24A
Offset (hex)Bytes (hex)Meaning

Explain query execution

query_text holds this document:

TRON165 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
045C 3F6E616D65txt "?name"
0A0E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
172C 3F65txt "?e"
1A4C 6E616D65txt "name"
1F5C 3F6E616D65txt "?name"
250E 15 00 0700 030000 00 17000000 1A0000 00 1F000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @17 → @1A → @1F
3A0E 0D 00 0100 010000 00 25000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @25
475C 3F6E616D65txt "?name"
4D0E 0D 00 0100 010000 00 47000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @47
5A5C 7768657265txt "where"
600F 0A 5A000000 3A00 0000map leaf, size 10: @5A → @3A
6A4C 66696E64txt "find"
6F0F 0A 6A000000 0A00 0000map leaf, size 10: @6A → @A
797C 6F726465724279txt "orderBy"
810F 0A 79000000 4D00 0000map leaf, size 10: @79 → @4D
8B07 12 2A000000 6000 0000 6F000000 8100 0000map branch, size 18, depth 0 (root), slots 1, 3, 5: @60 → @6F → @81
python198 B
explain = stardust.QueryExplain()
async with (await stardust.parse(query_text, "tron")) as definition, (await db.query(definition)) as query, (await query.run(explain=explain)):
    result = explain
TRON1.1 kB
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
004BC 6172656E615F62 79746573txt "arena_bytes"
01002 90060000000000 00i64 1680
0190F 0A 04000000 1000 0000map leaf, size 10: @4 → @10
0233C 637075txt "cpu"
02702 50050000000000 00i64 1360
0300F 0A 23000000 2700 0000map leaf, size 10: @23 → @27
03A4C 77616C6Ctxt "wall"
03F02 5A050000000000 00i64 1370
0480F 0A 3A000000 3F00 0000map leaf, size 10: @3A → @3F
05207 12 21800000 1900 0000 30000000 4800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @19 → @30 → @48
064BC 6172656E615F62 79746573txt "arena_bytes"
07002 00000000000000 00i64 0
0790F 0A 64000000 7000 0000map leaf, size 10: @64 → @70
0833C 637075txt "cpu"
08702 00000000000000 00i64 0
0900F 0A 83000000 8700 0000map leaf, size 10: @83 → @87
09A4C 77616C6Ctxt "wall"
09F02 0A000000000000 00i64 10
0A80F 0A 9A000000 9F00 0000map leaf, size 10: @9A → @9F
0B207 12 21800000 7900 0000 90000000 A800 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @79 → @90 → @A8
0C4BC 6172656E615F62 79746573txt "arena_bytes"
0D002 001D0000000000 00i64 7424
0D90F 0A C4000000 D000 0000map leaf, size 10: @C4 → @D0
0E33C 637075txt "cpu"
0E702 881D0000000000 00i64 7560
0F00F 0A E3000000 E700 0000map leaf, size 10: @E3 → @E7
0FA4C 77616C6Ctxt "wall"
0FF02 9C1D0000000000 00i64 7580
1080F 0A FA000000 FF00 0000map leaf, size 10: @FA → @FF
11207 12 21800000 D900 0000 F0000000 0801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @D9 → @F0 → @108
124BC 6172656E615F62 79746573txt "arena_bytes"
Show all 106 nodes
Offset (hex)Bytes (hex)Meaning
13002 90230000000000 00i64 9104
1390F 0A 24010000 3001 0000map leaf, size 10: @124 → @130
1433C 637075txt "cpu"
14702 00230000000000 00i64 8960
1500F 0A 43010000 4701 0000map leaf, size 10: @143 → @147
15A4C 77616C6Ctxt "wall"
15F02 1E230000000000 00i64 8990
1680F 0A 5A010000 5F01 0000map leaf, size 10: @15A → @15F
17207 12 21800000 3901 0000 50010000 6801 0000map branch, size 18, depth 0 (root), slots 0, 5, 15: @139 → @150 → @168
1847C 65786563757465txt "execute"
18C02 00000000000000 00i64 0
1950F 0A 84010000 8C01 0000map leaf, size 10: @184 → @18C
19F4C 726F7773txt "rows"
1A402 03000000000000 00i64 3
1AD0F 0A 9F010000 A401 0000map leaf, size 10: @19F → @1A4
1B74C 706C616Etxt "plan"
1BC02 90010000000000 00i64 400
1C50F 0A B7010000 BC01 0000map leaf, size 10: @1B7 → @1BC
1CF3C 72756Etxt "run"
1D30F 0A CF010000 1201 0000map leaf, size 10: @1CF → @112
1DD07 12 01840000 AD01 0000 C5010000 D301 0000map branch, size 18, depth 1, slots 0, 10, 15: @1AD → @1C5 → @1D3
1EF5C 67726F7570txt "group"
1F502 00000000000000 00i64 0
1FE0F 0A EF010000 F501 0000map leaf, size 10: @1EF → @1F5
2087C 636F6D70696C65txt "compile"
21002 F0000000000000 00i64 240
2190F 0A 08020000 1002 0000map leaf, size 10: @208 → @210
223AC 706172616D6574 657273txt "parameters"
22E0F 0A 23020000 B200 0000map leaf, size 10: @223 → @B2
23814 10 737461676573 5F636F6D706C6574 6564txt "stages_completed"
24A02 03000000000000 00i64 3
2530F 0A 38020000 4A02 0000map leaf, size 10: @238 → @24A
25D5C 6F72646572txt "order"
26302 00000000000000 00i64 0
26C0F 0A 5D020000 6302 0000map leaf, size 10: @25D → @263
27607 0E C0000000 5302 0000 6C020000map branch, size 14, depth 1, slots 6, 7: @253 → @26C
284EC 6172656E615F63 61706163697479txt "arena_capacity"
29302 00004000000000 00i64 4194304
29C0F 0A 84020000 9302 0000map leaf, size 10: @284 → @293
2A614 11 627564676574 5F757365645F6279 746573txt "budget_used_bytes"
2B902 D2270000000000 00i64 10194
2C20F 0A A6020000 B902 0000map leaf, size 10: @2A6 → @2B9
2CC07 0E 24000000 9C02 0000 C2020000map branch, size 14, depth 1, slots 2, 5: @29C → @2C2
2DAFC 6275646765745F 7265667573616C73txt "budget_refusals"
2EA02 00000000000000 00i64 0
2F30F 0A DA020000 EA02 0000map leaf, size 10: @2DA → @2EA
2FD4C 776F726Btxt "work"
30202 F2120000000000 00i64 4850
30B0F 0A FD020000 0203 0000map leaf, size 10: @2FD → @302
31507 0E 88000000 F302 0000 0B030000map branch, size 14, depth 1, slots 3, 7: @2F3 → @30B
323FC 6D656D6F72795F 7265667573616C73txt "memory_refusals"
33302 00000000000000 00i64 0
33C0F 0A 23030000 3303 0000map leaf, size 10: @323 → @333
346CC 6275646765745F 6279746573txt "budget_bytes"
35302 00823E71020000 00i64 10489856512
35C0F 0A 46030000 5303 0000map leaf, size 10: @346 → @353
3665C 746F74616Ctxt "total"
36C0F 0A 66030000 7201 0000map leaf, size 10: @366 → @172
37614 11 627564676574 5F7065616B5F6279 746573txt "budget_peak_bytes"
38902 BB370000000000 00i64 14267
3920F 0A 76030000 8903 0000map leaf, size 10: @376 → @389
39C07 16 13040000 3C03 0000 5C030000 6C03 0000 92030000map branch, size 22, depth 1, slots 0, 1, 4, 10: @33C → @35C → @36C → @392
3B25C 7265747279txt "retry"
3B802 00000000000000 00i64 0
3C10F 0A B2030000 B803 0000map leaf, size 10: @3B2 → @3B8
3CB7C 72657472696573txt "retries"
3D302 00000000000000 00i64 0
3DC0F 0A CB030000 D303 0000map leaf, size 10: @3CB → @3D3
3E6CC 6D656D6F72795F 6279746573txt "memory_bytes"
3F302 6B170000000000 00i64 5995
3FC0F 0A E6030000 F303 0000map leaf, size 10: @3E6 → @3F3
406FC 6C6F61645F6465 66696E6974696F6Etxt "load_definition"
4160F 0A 06040000 5200 0000map leaf, size 10: @406 → @52
42007 0E 01100000 FC03 0000 16040000map branch, size 14, depth 1, slots 0, 12: @3FC → @416
42E07 36 FBDA0000 9501 0000 DD010000 FE01 0000 19020000 2E02 0000 76020000 CC02 0000 15030000 9C03 0000 C1030000 DC03 0000 20040000map branch, size 54, depth 0 (root), slots 0, 1, 3, 4, 5, 6, 7, 9, 11, 12, 14, 15: @195 → @1DD → @1FE → @219 → @22E → @276 → @2CC → @315 → @39C → @3C1 → @3DC → @420
Offset (hex)Bytes (hex)Meaning