-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
roachpb/sql/ui: add mean rows written to Statement Details page #70377
Conversation
hi! sorry y'all, I somehow closed my last PR when I was trying to rebase on upstream. I couldn't figure out how to recover that, so I've created a new one (although let me know if you have any tips if I run into this issue in the future!) |
61c6631
to
c769f07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 14 files at r1, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @lindseyjin)
pkg/roachpb/app_stats.proto, line 90 at r1 (raw file):
optional NumericStat rows_read = 16 [(gogoproto.nullable) = false]; // RowsWritten collects the number of rows read from disk.
s/rows read from/rows written to/
pkg/ui/workspaces/cluster-ui/src/statementDetails/statementDetails.tsx, line 506 at r1 (raw file):
); const summary = summarize(statement); const notSelectStatement = summary.statement !== "select";
Reading the function of summarize()
, I think this would also include statements like SET CLUSTER SETTINGS ...
even though those statements does not always change stored data on disk.
Also, I feel this summarize()
function doesn't capture the full picture. We also have UPSERT
statements that does conditional update/insert operations.
Additionally, user can do PREPARE insert_stmt AS INSERT INTO table VALUES ($1)
and then EXECUTE insert_stmt(...)
, the subsequent EXECUTE
would also have mean rows written
stats.
cc @maryliag any thoughts on handling these special cases ?
c769f07
to
c167392
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @lindseyjin and @maryliag)
pkg/ui/workspaces/cluster-ui/src/statementDetails/statementDetails.tsx, line 506 at r1 (raw file):
Previously, Azhng (Archer Zhang) wrote…
Reading the function of
summarize()
, I think this would also include statements likeSET CLUSTER SETTINGS ...
even though those statements does not always change stored data on disk.Also, I feel this
summarize()
function doesn't capture the full picture. We also haveUPSERT
statements that does conditional update/insert operations.Additionally, user can do
PREPARE insert_stmt AS INSERT INTO table VALUES ($1)
and thenEXECUTE insert_stmt(...)
, the subsequentEXECUTE
would also havemean rows written
stats.cc @maryliag any thoughts on handling these special cases ?
Hmm, currently the ticket only mentions hiding this metric for SELECT statements. Is the problem that we don't want to show "mean rows written" for any statements that aren't able to modify rows?
c167392
to
d503e34
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @Azhng and @maryliag)
pkg/roachpb/app_stats.proto, line 90 at r1 (raw file):
Previously, Azhng (Archer Zhang) wrote…
s/rows read from/rows written to/
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @Azhng)
pkg/ui/workspaces/cluster-ui/src/statementDetails/statementDetails.tsx, line 506 at r1 (raw file):
Previously, lindseyjin (Lindsey Jin) wrote…
Hmm, currently the ticket only mentions hiding this metric for SELECT statements. Is the problem that we don't want to show "mean rows written" for any statements that aren't able to modify rows?
I had left a previous comment on the other PR, for this here you need to checks: only show if statement type is DML, and if it is DML hide if is select type.
So I would change the notSelectStatement
const to showRowsWritten
and its value would be something like this (not sure the right parameter name for SQL Type)
const showRowsWritten = statement.sqltype === 'DML' and summary.statement !== 'statement'
and then below you can show {showRowsWritten && (...
d503e34
to
fd309c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @Azhng)
pkg/ui/workspaces/cluster-ui/src/statementDetails/statementDetails.tsx, line 506 at r1 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
I had left a previous comment on the other PR, for this here you need to checks: only show if statement type is DML, and if it is DML hide if is select type.
So I would change thenotSelectStatement
const toshowRowsWritten
and its value would be something like this (not sure the right parameter name for SQL Type)
const showRowsWritten = statement.sqltype === 'DML' and summary.statement !== 'statement'
and then below you can show
{showRowsWritten && (...
Done!
Couldn't find if there was an existing enum for sql types, but let me know if one exists!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 10 of 14 files at r1, 1 of 1 files at r3, 2 of 2 files at r4, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @Azhng, @lindseyjin, and @maryliag)
pkg/ui/workspaces/cluster-ui/src/statementDetails/statementDetails.tsx, line 581 at r4 (raw file):
<Text> {formatNumberForDisplay( stats.rows_written.mean,
nit: to account for cluster with version where this parameter might not exist, change this to stats.rows_written?.mean
pkg/ui/workspaces/cluster-ui/src/statementsPage/statementsPage.fixture.ts, line 92 at r4 (raw file):
}, rows_written: { mean: 10,
nit: use a different value from rows read, because during tests we want different values to make sure we're not using a value from a different parameter for example
pkg/ui/workspaces/cluster-ui/src/util/appStats/appStats.fixture.ts, line 208 at r4 (raw file):
squared_diffs: 3.8399999999999994, }, rows_written: {
nit: same as the other comment, change the values of rows written to some other random value different from rows read
pkg/ui/workspaces/db-console/src/util/appStats.ts, line 85 at r4 (raw file):
bytes_read: addNumericStats(a.bytes_read, b.bytes_read, countA, countB), rows_read: addNumericStats(a.rows_read, b.rows_read, countA, countB), rows_written: addNumericStats(a.rows_read, b.rows_read, countA, countB),
this is suppose to be rows_written, you forgot to change the values inside the function
fa237d1
to
ac7c3ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @Azhng and @maryliag)
pkg/ui/workspaces/db-console/src/util/appStats.ts, line 85 at r4 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
this is suppose to be rows_written, you forgot to change the values inside the function
Done.
0de6ade
to
56f14ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 14 files at r1, 2 of 4 files at r5, 1 of 1 files at r6, 1 of 1 files at r7, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @Azhng)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized that this metric should also be added to the Execution Stats Tab of the Statement Details. Can you add it there? Just below the read row on the "Other Execution Statistics". table
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @Azhng)
56f14ab
to
2372a0f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it! do I just need to add this into the "Other Execution Stats" table, or also the "Stats By Node" table?\
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @Azhng and @maryliag)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That stats by node is based on the same statement table from the main page, so once you add there on your following task, it will get added on this table too. So don't worry about it on this PR, but on your next one make sure you test on this page
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @Azhng and @maryliag)
2372a0f
to
8aea9f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, sounds good!
Also, done!
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @Azhng and @maryliag)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @Azhng and @maryliag)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r8.
Reviewable status:complete! 2 of 0 LGTMs obtained (waiting on @maryliag)
Resolves cockroachdb#67084 Previously, the Statement Details page did not show the mean rows written to. We received feedback to surface rows affected. To address this, we are adding "mean rows written" to non-SELECT statements. This has been added as a row on the Statement Details Overview page and on the Execution Stats "Other Execution Stats" table. A future PR will also add this new metric to the column selector on the Statements Overview page. Release note (ui change): add mean rows written to statement details page
8aea9f5
to
d1568ad
Compare
^^ Pushing to resolve merge conflicts |
bors r+ |
Build succeeded: |
Resolves #67084
Previously, the Statement Details page did not show the mean rows
written to. We received feedback to surface rows affected.
To address this, we are adding "mean rows written" to non-SELECT
statements. This has been added as a row on the Statement Details
Overview page and on the Execution Stats "Other Execution Stats" table.
A future PR will also add this new metric to the column selector on
the Statements Overview page.
Release note (ui change): add mean rows written to statement details page