Hello Calcite devs,

We’re trying to build a tool to help us analyze the performance of Calcite
queries to give insights on better practices, beyond simply evaluating the
execution time of the entire query.


What we’d like to achieve is an analysis of the nodes of an executable
plan, indicating the time of execution as well as the number of rows
produced for each `RelNode`.


Example: for a query SELECT COUNT(*) FROM test_table_1 WHERE id = '1', we’d
like to achieve something similar to:


EnumerableAggregate(group=[{}], EXPR$0=[COUNT()]) → time = 1s, rows = 1

  EnumerableCalc(expr#0..10=[{inputs}], expr#11=['1':VARCHAR],
expr#12=[=($t4, $t11)], proj#0..10=[{exprs}], $condition=[$t12]) → time =
0.5s, rows = 2

    TableScan(table=[[test_table]], filters=[null]) → time = 0.4s, rows = 3


We’re thinking about devising a way to modify the generated code of
`RelNode`s to extend their results with execution statistics, but we’re
also curious if you know of any prior art in this area. If not, do you
think that attempting to instrument the generated code is a reasonable
solution to pursue?


Thank you,

Reply via email to