Skip to content

Commit f46fdd6

Browse files
Merge pull request #922 from prometheus/cristian/ps_statements_quantiles
Use QUANTILE columns only with mysql >= 8.0.28
2 parents ce68e7b + 99d131b commit f46fdd6

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

collector/perf_schema_events_statements.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ const perfEventsStatementsQuery = `
4141
SUM_CREATED_TMP_TABLES,
4242
SUM_SORT_MERGE_PASSES,
4343
SUM_SORT_ROWS,
44-
SUM_NO_INDEX_USED,
45-
QUANTILE_95,
46-
QUANTILE_99,
47-
QUANTILE_999
44+
SUM_NO_INDEX_USED
4845
FROM (
4946
SELECT *
5047
FROM performance_schema.events_statements_summary_by_digest
@@ -67,10 +64,7 @@ const perfEventsStatementsQuery = `
6764
Q.SUM_CREATED_TMP_TABLES,
6865
Q.SUM_SORT_MERGE_PASSES,
6966
Q.SUM_SORT_ROWS,
70-
Q.SUM_NO_INDEX_USED,
71-
Q.QUANTILE_95,
72-
Q.QUANTILE_99,
73-
Q.QUANTILE_999
67+
Q.SUM_NO_INDEX_USED
7468
ORDER BY SUM_TIMER_WAIT DESC
7569
LIMIT %d
7670
`
@@ -284,7 +278,7 @@ func (ScrapePerfEventsStatements) Scrape(ctx context.Context, instance *instance
284278
)
285279
} else {
286280
err = perfSchemaEventsStatementsRows.Scan(
287-
&schemaName, &digest, &digestText, &count, &queryTime, &errors, &warnings, &rowsAffected, &rowsSent, &rowsExamined, &tmpDiskTables, &tmpTables, &sortMergePasses, &sortRows, &noIndexUsed, &quantile95, &quantile99, &quantile999,
281+
&schemaName, &digest, &digestText, &count, &queryTime, &errors, &warnings, &rowsAffected, &rowsSent, &rowsExamined, &tmpDiskTables, &tmpTables, &sortMergePasses, &sortRows, &noIndexUsed,
288282
)
289283
}
290284
if err != nil {

collector/perf_schema_events_statements_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ func TestScrapePerfEventsStatements(t *testing.T) {
3939
"SUM_ROWS_AFFECTED", "SUM_ROWS_SENT", "SUM_ROWS_EXAMINED",
4040
"SUM_CREATED_TMP_DISK_TABLES", "SUM_CREATED_TMP_TABLES", "SUM_SORT_MERGE_PASSES",
4141
"SUM_SORT_ROWS", "SUM_NO_INDEX_USED",
42-
"QUANTILE_95", "QUANTILE_99", "QUANTILE_999",
4342
}
4443

4544
rows := sqlmock.NewRows(columns).
@@ -48,8 +47,7 @@ func TestScrapePerfEventsStatements(t *testing.T) {
4847
100, 1000, 1, 2,
4948
50, 100, 150,
5049
1, 2, 3,
51-
100, 1,
52-
100, 150, 200)
50+
100, 1)
5351

5452
query := fmt.Sprintf(perfEventsStatementsQuery, 120, 86400, 250)
5553
mock.ExpectQuery(sanitizeQuery(query)).WillReturnRows(rows)

0 commit comments

Comments
 (0)