Skip to content

Minor enhancements to EXPLAIN ANALYZE output formatting #18689

Description

@2010YOUY01

Is your feature request related to a problem or challenge?

Here are several minor items to make EXPLAIN ANALYZE display nicer:

  • Format large numeric values with human-readable units (e.g., 10100 → 10.1 K, 1532000 → 1.53 M)
  • Round time durations to two decimal places (e.g., elapsed_compute=11.295377 ms → 11.30 ms)

Demo(in datafusion-cli)

> explain analyze
select *
from generate_series(10000000) as t1(v1)
where v1 > 100;
+-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type         | plan                                                                                                                                                                                                                                                                                                      |
+-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Plan with Metrics | ProjectionExec: expr=[value@0 as v1], metrics=[output_rows=9999900, elapsed_compute=213.26µs, output_bytes=76.3 MB, output_batches=1221]                                                                                                                                                                  |
|                   |   CoalesceBatchesExec: target_batch_size=8192, metrics=[output_rows=9999900, elapsed_compute=69.983µs, output_bytes=76.3 MB, output_batches=1221]                                                                                                                                                         |
|                   |     FilterExec: value@0 > 100, metrics=[output_rows=9999900, elapsed_compute=4.263662ms, output_bytes=76.3 MB, output_batches=1221, selectivity=100% (9999900/10000001)]                                                                                                                                  |
|                   |       RepartitionExec: partitioning=RoundRobinBatch(14), input_partitions=1, metrics=[output_rows=10000001, elapsed_compute=451.452µs, output_bytes=76.3 MB, output_batches=1221, spill_count=0, spilled_bytes=0.0 B, spilled_rows=0, fetch_time=11.416792ms, repartition_time=1ns, send_time=1.382266ms] |
|                   |         LazyMemoryExec: partitions=1, batch_generators=[generate_series: start=0, end=10000000, batch_size=8192], metrics=[output_rows=10000001, elapsed_compute=11.295377ms, output_bytes=76.3 MB, output_batches=1221]                                                                                  |
|                   |                                                                                                                                                                                                                                                                                                           |
+-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.017 seconds.

From the demo output, I think output_rows, and the ratio numerator and denominator is applicable. e.g. output_rows = 1.31 M, and selectivity = 15% (15.11k / 100.32k), and all time measurements can be rounded.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions