Skip to content

Commit

Permalink
Merge pull request cockroachdb#117496 from maryliag/backport23.1-116976
Browse files Browse the repository at this point in the history
release-23.1: server: fix total latency time on sql stats call
  • Loading branch information
maryliag authored Jan 8, 2024
2 parents 1391d7d + 8e1324d commit 5a4e1d0
Show file tree
Hide file tree
Showing 2 changed files with 475 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/server/combined_statement_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,9 @@ FROM %s %s`, table, whereClauseOldestDate), args...)

createActivityTableQuery := func(table string) string {
return fmt.Sprintf(`
SELECT COALESCE(
execution_total_cluster_seconds,
0)
FROM %s %s LIMIT 1`, table, whereClause)
SELECT COALESCE(sum(total_latency), 0) from (SELECT aggregated_ts,
max(execution_total_cluster_seconds) as total_latency
FROM %s %s GROUP BY aggregated_ts) %s`, table, whereClause, testingKnobs.GetAOSTClause())
}

createStatsTableQuery := func(table string) string {
Expand Down
Loading

0 comments on commit 5a4e1d0

Please sign in to comment.