Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: humanize counts and durations in EXPLAIN ANALYZE #57420

Merged
merged 1 commit into from Dec 3, 2020

Conversation

RaduBerinde
Copy link
Member

This change humanizes all statistics showed in EXPLAIN and EXPLAIN
ANALYZE (both the text and the diagram):

  • byte values were already humanized
  • row counts are shown with commas (e.g. 1,000,000);
  • durations are rounded out in a more friendly way. Most importantly,
    we no longer show a lot of decimals for multi-second times, and the
    zero value is now shown as "0µs" instead of "0s" (the latter can be
    confusing, e.g. is it hiding a 100ms time?).

Release note (sql change): EXPLAIN and EXPLAIN ANALYZE now show counts
and durations in a more user-friendly way.

@RaduBerinde RaduBerinde requested a review from a team as a code owner December 2, 2020 23:50
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 47 of 47 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @asubiotto and @RaduBerinde)


pkg/sql/execinfrapb/component_stats.go, line 57 at r1 (raw file):

	}
	if s.NetRx.TuplesReceived.HasValue() {
		fn("network tuples received", humanize.Comma(int64(s.NetRx.TuplesReceived.Value())))

[nit] what do you think about adding a function humanizeutil.Count that calls humanize.Comma? That would be more consistent with humanizeutil.Duration.


pkg/util/humanizeutil/duration_test.go, line 25 at r1 (raw file):

		{val: 0, exp: "0µs"},
		{val: 12, exp: "0µs"},
		{val: 1234, exp: "1µs"},

What about checking that 501 rounds up to 1 microsecond?

Copy link
Member Author

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @asubiotto and @rytaft)


pkg/sql/execinfrapb/component_stats.go, line 57 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

[nit] what do you think about adding a function humanizeutil.Count that calls humanize.Comma? That would be more consistent with humanizeutil.Duration.

Done.


pkg/util/humanizeutil/duration_test.go, line 25 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

What about checking that 501 rounds up to 1 microsecond?

Done.

@RaduBerinde RaduBerinde force-pushed the humanize-counts branch 3 times, most recently from 54cdfa8 to 5658763 Compare December 3, 2020 17:26
Copy link
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 8 of 8 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @asubiotto and @RaduBerinde)


pkg/util/humanizeutil/count.go, line 15 at r2 (raw file):

import "github.com/dustin/go-humanize"

// Count formats a unitless iteger value like a row count. It uses separating

[nit] iteger -> integer

This change humanizes all statistics showed in EXPLAIN and EXPLAIN
ANALYZE (both the text and the diagram):
 - byte values were already humanized
 - row counts are shown with commas (e.g. 1,000,000);
 - durations are rounded out in a more friendly way. Most importantly,
   we no longer show a lot of decimals for multi-second times, and the
   zero value is now shown as "0µs" instead of "0s" (the latter can be
   confusing, e.g. is it hiding a 100ms time?).

Release note (sql change): EXPLAIN and EXPLAIN ANALYZE now show counts
and durations in a more user-friendly way.
@RaduBerinde
Copy link
Member Author

bors r+

@craig
Copy link
Contributor

craig bot commented Dec 3, 2020

Build succeeded:

@craig craig bot merged commit 00bdf71 into cockroachdb:master Dec 3, 2020
@RaduBerinde RaduBerinde deleted the humanize-counts branch December 4, 2020 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants