Skip to content

Commit

Permalink
Merge #92926
Browse files Browse the repository at this point in the history
92926: sqlstats: add idle_lat to node_transaction_statistics r=matthewtodd a=matthewtodd

Part of #86667

No release note here since `node_statement_statistics` is not one of the ["Use in production" `crdb_internal` tables](https://www.cockroachlabs.com/docs/stable/crdb-internal.html#tables).

Release note: None

Co-authored-by: Matthew Todd <[email protected]>
  • Loading branch information
craig[bot] and matthewtodd committed Dec 2, 2022
2 parents f7f24fb + 657251b commit 4f904eb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ SELECT * FROM crdb_internal.node_statement_statistics WHERE node_id < 0
----
node_id application_name flags statement_id key anonymized count first_attempt_count max_retries last_error rows_avg rows_var idle_lat_avg idle_lat_var parse_lat_avg parse_lat_var plan_lat_avg plan_lat_var run_lat_avg run_lat_var service_lat_avg service_lat_var overhead_lat_avg overhead_lat_var bytes_read_avg bytes_read_var rows_read_avg rows_read_var rows_written_avg rows_written_var network_bytes_avg network_bytes_var network_msgs_avg network_msgs_var max_mem_usage_avg max_mem_usage_var max_disk_usage_avg max_disk_usage_var contention_time_avg contention_time_var implicit_txn full_scan sample_plan database_name exec_node_ids txn_fingerprint_id index_recommendations

query ITTTIIRRRRRRRRRRRRRRRRRR colnames
query ITTTIIRRRRRRRRRRRRRRRRRRRR colnames
SELECT * FROM crdb_internal.node_transaction_statistics WHERE node_id < 0
----
node_id application_name key statement_ids count max_retries service_lat_avg service_lat_var retry_lat_avg retry_lat_var commit_lat_avg commit_lat_var rows_read_avg rows_read_var network_bytes_avg network_bytes_var network_msgs_avg network_msgs_var max_mem_usage_avg max_mem_usage_var max_disk_usage_avg max_disk_usage_var contention_time_avg contention_time_var
node_id application_name key statement_ids count max_retries service_lat_avg service_lat_var retry_lat_avg retry_lat_var commit_lat_avg commit_lat_var idle_lat_avg idle_lat_var rows_read_avg rows_read_var network_bytes_avg network_bytes_var network_msgs_avg network_msgs_var max_mem_usage_avg max_mem_usage_var max_disk_usage_avg max_disk_usage_var contention_time_avg contention_time_var

query IITTTTTTT colnames
SELECT * FROM crdb_internal.session_trace WHERE span_idx < 0
Expand Down
4 changes: 4 additions & 0 deletions pkg/sql/crdb_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,8 @@ CREATE TABLE crdb_internal.node_transaction_statistics (
retry_lat_var FLOAT NOT NULL,
commit_lat_avg FLOAT NOT NULL,
commit_lat_var FLOAT NOT NULL,
idle_lat_avg FLOAT NOT NULL,
idle_lat_var FLOAT NOT NULL,
rows_read_avg FLOAT NOT NULL,
rows_read_var FLOAT NOT NULL,
network_bytes_avg FLOAT,
Expand Down Expand Up @@ -1413,6 +1415,8 @@ CREATE TABLE crdb_internal.node_transaction_statistics (
tree.NewDFloat(tree.DFloat(stats.Stats.RetryLat.GetVariance(stats.Stats.Count))), // retry_lat_var
tree.NewDFloat(tree.DFloat(stats.Stats.CommitLat.Mean)), // commit_lat_avg
tree.NewDFloat(tree.DFloat(stats.Stats.CommitLat.GetVariance(stats.Stats.Count))), // commit_lat_var
tree.NewDFloat(tree.DFloat(stats.Stats.IdleLat.Mean)), // idle_lat_avg
tree.NewDFloat(tree.DFloat(stats.Stats.IdleLat.GetVariance(stats.Stats.Count))), // idle_lat_var
tree.NewDFloat(tree.DFloat(stats.Stats.NumRows.Mean)), // rows_read_avg
tree.NewDFloat(tree.DFloat(stats.Stats.NumRows.GetVariance(stats.Stats.Count))), // rows_read_var
execStatAvg(stats.Stats.ExecStats.Count, stats.Stats.ExecStats.NetworkBytes), // network_bytes_avg
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/logictest/testdata/logic_test/crdb_internal
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ SELECT * FROM crdb_internal.node_statement_statistics WHERE node_id < 0
----
node_id application_name flags statement_id key anonymized count first_attempt_count max_retries last_error rows_avg rows_var idle_lat_avg idle_lat_var parse_lat_avg parse_lat_var plan_lat_avg plan_lat_var run_lat_avg run_lat_var service_lat_avg service_lat_var overhead_lat_avg overhead_lat_var bytes_read_avg bytes_read_var rows_read_avg rows_read_var rows_written_avg rows_written_var network_bytes_avg network_bytes_var network_msgs_avg network_msgs_var max_mem_usage_avg max_mem_usage_var max_disk_usage_avg max_disk_usage_var contention_time_avg contention_time_var implicit_txn full_scan sample_plan database_name exec_node_ids txn_fingerprint_id index_recommendations

query ITTTIIRRRRRRRRRRRRRRRRRR colnames
query ITTTIIRRRRRRRRRRRRRRRRRRRR colnames
SELECT * FROM crdb_internal.node_transaction_statistics WHERE node_id < 0
----
node_id application_name key statement_ids count max_retries service_lat_avg service_lat_var retry_lat_avg retry_lat_var commit_lat_avg commit_lat_var rows_read_avg rows_read_var network_bytes_avg network_bytes_var network_msgs_avg network_msgs_var max_mem_usage_avg max_mem_usage_var max_disk_usage_avg max_disk_usage_var contention_time_avg contention_time_var
node_id application_name key statement_ids count max_retries service_lat_avg service_lat_var retry_lat_avg retry_lat_var commit_lat_avg commit_lat_var idle_lat_avg idle_lat_var rows_read_avg rows_read_var network_bytes_avg network_bytes_var network_msgs_avg network_msgs_var max_mem_usage_avg max_mem_usage_var max_disk_usage_avg max_disk_usage_var contention_time_avg contention_time_var

query IITTTTTTT colnames
SELECT * FROM crdb_internal.session_trace WHERE span_idx < 0
Expand Down
4 changes: 4 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/create_statements
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,8 @@ CREATE TABLE crdb_internal.node_transaction_statistics (
retry_lat_var FLOAT8 NOT NULL,
commit_lat_avg FLOAT8 NOT NULL,
commit_lat_var FLOAT8 NOT NULL,
idle_lat_avg FLOAT8 NOT NULL,
idle_lat_var FLOAT8 NOT NULL,
rows_read_avg FLOAT8 NOT NULL,
rows_read_var FLOAT8 NOT NULL,
network_bytes_avg FLOAT8 NULL,
Expand All @@ -1272,6 +1274,8 @@ CREATE TABLE crdb_internal.node_transaction_statistics (
retry_lat_var FLOAT8 NOT NULL,
commit_lat_avg FLOAT8 NOT NULL,
commit_lat_var FLOAT8 NOT NULL,
idle_lat_avg FLOAT8 NOT NULL,
idle_lat_var FLOAT8 NOT NULL,
rows_read_avg FLOAT8 NOT NULL,
rows_read_var FLOAT8 NOT NULL,
network_bytes_avg FLOAT8 NULL,
Expand Down

0 comments on commit 4f904eb

Please sign in to comment.