Skip to content

Commit b82045b

Browse files
committed
Use QUANTILE columns only with mysql >= 8.0.28
Followup of #916 and #920. These columns are not available in MariaDB.
1 parent ce68e7b commit b82045b

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

collector/perf_schema_events_statements.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ const perfEventsStatementsQuery = `
6767
Q.SUM_CREATED_TMP_TABLES,
6868
Q.SUM_SORT_MERGE_PASSES,
6969
Q.SUM_SORT_ROWS,
70-
Q.SUM_NO_INDEX_USED,
71-
Q.QUANTILE_95,
72-
Q.QUANTILE_99,
73-
Q.QUANTILE_999
70+
Q.SUM_NO_INDEX_USED
7471
ORDER BY SUM_TIMER_WAIT DESC
7572
LIMIT %d
7673
`
@@ -284,7 +281,7 @@ func (ScrapePerfEventsStatements) Scrape(ctx context.Context, instance *instance
284281
)
285282
} else {
286283
err = perfSchemaEventsStatementsRows.Scan(
287-
&schemaName, &digest, &digestText, &count, &queryTime, &errors, &warnings, &rowsAffected, &rowsSent, &rowsExamined, &tmpDiskTables, &tmpTables, &sortMergePasses, &sortRows, &noIndexUsed, &quantile95, &quantile99, &quantile999,
284+
&schemaName, &digest, &digestText, &count, &queryTime, &errors, &warnings, &rowsAffected, &rowsSent, &rowsExamined, &tmpDiskTables, &tmpTables, &sortMergePasses, &sortRows, &noIndexUsed,
288285
)
289286
}
290287
if err != nil {

collector/perf_schema_events_statements_test.go

+1-3
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)