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: add execution stats to node_statement_statistics #62006

Merged
merged 1 commit into from
Mar 16, 2021
Merged

sql: add execution stats to node_statement_statistics #62006

merged 1 commit into from
Mar 16, 2021

Conversation

asubiotto
Copy link
Contributor

Release justification: low-risk, high-benefit change to existing functionality
since this commit exposes pre-existing execution stats through the SQL shell.

Release note (sql change): sampled execution stats are now available through
node_statement_statistics.

Closes #61637

Putting @yuzefovich as primary reviewer but @maryliag and @Azhng, please take a look and let me know if you have any questions.

@asubiotto asubiotto requested review from maryliag, yuzefovich, Azhng and a team March 15, 2021 14:08
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@asubiotto
Copy link
Contributor Author

I did not run any tests locally, so I'm expecting CI to be red. Will fix and repush once that happens.

@asubiotto
Copy link
Contributor Author

I'll also update node_transaction_statistics. You can hold off reviewing until I update this PR.

@asubiotto
Copy link
Contributor Author

OK, should be ready for a review now.

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

:lgtm:

A couple of nits which you should feel free to ignore.

Reviewed 4 of 4 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @asubiotto, @Azhng, and @maryliag)


pkg/sql/crdb_internal.go, line 861 at r1 (raw file):

  rows_read_avg       FLOAT NOT NULL,
  rows_read_var       FLOAT NOT NULL,
  network_bytes_avg   FLOAT,

super nit: it might be nicer to put two "network" fields next each other as well as two "memory usage" fields.


pkg/sql/crdb_internal.go, line 964 at r1 (raw file):

					tree.NewDFloat(tree.DFloat(s.mu.data.RowsRead.Mean)),
					tree.NewDFloat(tree.DFloat(s.mu.data.RowsRead.GetVariance(s.mu.data.Count))),
					execStatAvg(s.mu.data.ExecStats.Count, s.mu.data.ExecStats.NetworkBytes),

super nit: it might be helpful to put an inlined comment for all of these with the column name, e.g. this line would be // network_bytes_avg. We seem to follow such pattern for some virtual tables, and for this one in particular it would beneficial since it is very wide.

Copy link
Contributor Author

@asubiotto asubiotto left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @Azhng, @maryliag, and @yuzefovich)


pkg/sql/crdb_internal.go, line 861 at r1 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

super nit: it might be nicer to put two "network" fields next each other as well as two "memory usage" fields.

Done.


pkg/sql/crdb_internal.go, line 964 at r1 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

super nit: it might be helpful to put an inlined comment for all of these with the column name, e.g. this line would be // network_bytes_avg. We seem to follow such pattern for some virtual tables, and for this one in particular it would beneficial since it is very wide.

Done.

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

Thanks!

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


pkg/sql/crdb_internal.go, line 869 at r2 (raw file):

  max_disk_usage_avg  FLOAT,
  max_disk_usage_var  FLOAT,
  contention_time_avg FLOAT, 

super nit: seems like a dangling space.

Release justification: low-risk, high-benefit change to existing functionality
since this commit exposes pre-existing execution stats through the SQL shell.

Release note (sql change): sampled execution stats are now available through
node_{statement,transaction}_statistics.
Copy link
Contributor Author

@asubiotto asubiotto left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @Azhng, @maryliag, and @yuzefovich)


pkg/sql/crdb_internal.go, line 869 at r2 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

super nit: seems like a dangling space.

Done.

@asubiotto
Copy link
Contributor Author

TFTR

bors r=yuzefovich

@craig
Copy link
Contributor

craig bot commented Mar 16, 2021

Build succeeded:

@craig craig bot merged commit 98ae002 into cockroachdb:master Mar 16, 2021
@asubiotto asubiotto deleted the nses branch March 17, 2021 15:21
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.

sql: add sampled execution statistics to node_{statement,transaction}_statistics
3 participants