Repository: open-telemetry/opentelemetry-collector-contrib (2026-02-23T12:20:33Z)

Issue:
Add support for query plan identifier in the event exporter
### Component(s)

receiver/mysql

### Describe the issue you're reporting

**Background**

Currently, the MySQL receiver extracts and stores the query digest (query_id). However, because execution plans are not persisted in the database, the receiver must explicitly execute the EXPLAIN command to retrieve the plan at runtime.

Since these plans are generated dynamically and not inherently associated with a persistent identifier, we require a mechanism to uniquely identify each generated plan.

**Proposed Change**

Introduce a new field — query_plan_id (or alternatively query_plan_hash) — in both the top_query and samples collections.

**Requirements**

1. Plan-to-Query Correlation

2. The new query_plan_hash must uniquely identify the generated execution plan.

3. It must allow correlation between:

- The query that was explained, and

- The execution plan generated via the EXPLAIN command.

- The same identifier value should be reused consistently for both records.


**Cross-Collection Correlation (Top Query ↔ Samples)**

Since the execution plan is stored as part of the top_query record, the same query_plan_hash must also be included in the query_samples flow.

This enables correlation between:

- Plans ingested and stored in the top_query collection, and

- Associated records in the samples collection.

**Expected Outcome**

Adding query_plan_hash to both collections will ensure consistent and reliable correlation between queries, generated execution plans, and sampled query records.

### Tip

<sub>[React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/).</sub>


Discussion:
Pinging code owners:
- receiver/sqlserver: @sincejune @crobert-1

 See [Adding Labels via Comments](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#adding-labels-via-comments) if you do not have permissions to add labels yourself.

PR related to this issue -> [46272](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/46272)
@ebrdarSplunk Can you clarify, is this issue for the MySQL receiver, or SQL Server?
@crobert-1  this is for mysql, I added the wrong tag to the issue, can you please update
Pinging code owners for receiver/mysql: @antonblock @ishleenk17. See [Adding Labels via Comments](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#adding-labels-via-comments) if you do not have permissions to add labels yourself. For example, comment '/label priority:p2 -needs-triage' to set the priority and remove the needs-triage label.



Patch:
diff --git a/.chloggen/mysqlreceiver-add-plan-hash-to-topx.yaml b/.chloggen/mysqlreceiver-add-plan-hash-to-topx.yaml
new file mode 100644
index 0000000000000..4ce66bc3e5a50
--- /dev/null
+++ b/.chloggen/mysqlreceiver-add-plan-hash-to-topx.yaml
@@ -0,0 +1,27 @@
+# Use this changelog template to create an entry for release notes.
+
+# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
+change_type:
+  enhancement
+# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
+component:
+  receiver/mysql
+# A brief description of the change.  Surround your text with quotes ("") if it needs to start with a backtick (`).
+note:
+  Add `mysql.query_plan.hash` attribute to top query log records, enabling users to correlate top queries with their corresponding execution plans.
+# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
+issues: [46626]
+
+# (Optional) One or more lines of additional information to render under the primary note.
+# These lines will be padded with 2 spaces and then inserted directly into the document.
+# Use pipe (|) for multiline entries.
+subtext:
+
+# If your change doesn't affect end users or the exported elements of any package,
+# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
+# Optional: The change log or logs in which this entry should be included.
+# e.g. '[user]' or '[user, api]'
+# Include 'user' if the change is relevant to end users.
+# Include 'api' if there is a change to a library API.
+# Default: '[user]'
+change_logs: [user]
diff --git a/receiver/mysqlreceiver/documentation.md b/receiver/mysqlreceiver/documentation.md
index 1c675965a4d82..dfa4ded5eb25c 100644
--- a/receiver/mysqlreceiver/documentation.md
+++ b/receiver/mysqlreceiver/documentation.md
@@ -697,6 +697,7 @@ This provides real-time visibility into active queries, helping users monitor da
 | mysql.threads.processlist_state | An action, event, or state that indicates what the thread is doing. | Any Str |
 | db.query.text | The SQL statement text for the event. | Any Str |
 | mysql.events_statements_current.digest | The statement digest SHA-256 value as a string of 64 hexadecimal characters, or empty if the statements_digest consumer is no. | Any Str |
+| mysql.query_plan.hash | This attribute is set to the same value as mysql.events_statements_summary_by_digest.digest (query digest) by design. | Any Str |
 | mysql.event_id | The thread associated with the event and the thread current event number when the event starts. | Any Int |
 | mysql.wait_type | The name of the instrument that produced the event. | Any Str |
 | mysql.session.status | Simplified session status, either 'waiting', 'running' or 'other'. | Any Str |
@@ -720,6 +721,7 @@ This provides insights into query performance and resource usage, helping users
 | db.system.name | The name of the database system. | Str: ``mysql`` |
 | db.query.text | The SQL statement text for the event. | Any Str |
 | mysql.query_plan | The query plan for the statement, if available. | Any Str |
+| mysql.query_plan.hash | This attribute is set to the same value as mysql.events_statements_summary_by_digest.digest (query digest) by design. | Any Str |
 | mysql.events_statements_summary_by_digest.digest | The statement digest SHA-256 value as a string of 64 hexadecimal characters, or empty if the statements_digest consumer is no. | Any Str |
 | mysql.events_statements_summary_by_digest.count_star | The number of times the statement was executed, report in delta value. | Any Int |
 | mysql.events_statements_summary_by_digest.sum_timer_wait | The total time spent executing the statement, report in delta seconds. | Any Double |
diff --git a/receiver/mysqlreceiver/internal/metadata/generated_logs.go b/receiver/mysqlreceiver/internal/metadata/generated_logs.go
index f9a36522285d4..ad8fe222b2a04 100644
--- a/receiver/mysqlreceiver/internal/metadata/generated_logs.go
+++ b/receiver/mysqlreceiver/internal/metadata/generated_logs.go
@@ -18,7 +18,7 @@ type eventDbServerQuerySample struct {
 	config EventConfig         // event config provided by user.
 }
 
-func (e *eventDbServerQuerySample) recordEvent(ctx context.Context, timestamp pcommon.Timestamp, dbSystemNameAttributeValue string, mysqlThreadsThreadIDAttributeValue int64, userNameAttributeValue string, dbNamespaceAttributeValue string, mysqlThreadsProcesslistCommandAttributeValue string, mysqlThreadsProcesslistStateAttributeValue string, dbQueryTextAttributeValue string, mysqlEventsStatementsCurrentDigestAttributeValue string, mysqlEventIDAttributeValue int64, mysqlWaitTypeAttributeValue string, mysqlSessionStatusAttributeValue string, mysqlSessionIDAttributeValue int64, mysqlEventsWaitsCurrentTimerWaitAttributeValue float64, clientAddressAttributeValue string, clientPortAttributeValue int64, networkPeerAddressAttributeValue string, networkPeerPortAttributeValue int64) {
+func (e *eventDbServerQuerySample) recordEvent(ctx context.Context, timestamp pcommon.Timestamp, dbSystemNameAttributeValue string, mysqlThreadsThreadIDAttributeValue int64, userNameAttributeValue string, dbNamespaceAttributeValue string, mysqlThreadsProcesslistCommandAttributeValue string, mysqlThreadsProcesslistStateAttributeValue string, dbQueryTextAttributeValue string, mysqlEventsStatementsCurrentDigestAttributeValue string, mysqlQueryPlanHashAttributeValue string, mysqlEventIDAttributeValue int64, mysqlWaitTypeAttributeValue string, mysqlSessionStatusAttributeValue string, mysqlSessionIDAttributeValue int64, mysqlEventsWaitsCurrentTimerWaitAttributeValue float64, clientAddressAttributeValue string, clientPortAttributeValue int64, networkPeerAddressAttributeValue string, networkPeerPortAttributeValue int64) {
 	if !e.config.Enabled {
 		return
 	}
@@ -38,6 +38,7 @@ func (e *eventDbServerQuerySample) recordEvent(ctx context.Context, timestamp pc
 	dp.Attributes().PutStr("mysql.threads.processlist_state", mysqlThreadsProcesslistStateAttributeValue)
 	dp.Attributes().PutStr("db.query.text", dbQueryTextAttributeValue)
 	dp.Attributes().PutStr("mysql.events_statements_current.digest", mysqlEventsStatementsCurrentDigestAttributeValue)
+	dp.Attributes().PutStr("mysql.query_plan.hash", mysqlQueryPlanHashAttributeValue)
 	dp.Attributes().PutInt("mysql.event_id", mysqlEventIDAttributeValue)
 	dp.Attributes().PutStr("mysql.wait_type", mysqlWaitTypeAttributeValue)
 	dp.Attributes().PutStr("mysql.session.status", mysqlSessionStatusAttributeValue)
@@ -70,7 +71,7 @@ type eventDbServerTopQuery struct {
 	config EventConfig         // event config provided by user.
 }
 
-func (e *eventDbServerTopQuery) recordEvent(ctx context.Context, timestamp pcommon.Timestamp, dbSystemNameAttributeValue string, dbQueryTextAttributeValue string, mysqlQueryPlanAttributeValue string, mysqlEventsStatementsSummaryByDigestDigestAttributeValue string, mysqlEventsStatementsSummaryByDigestCountStarAttributeValue int64, mysqlEventsStatementsSummaryByDigestSumTimerWaitAttributeValue float64) {
+func (e *eventDbServerTopQuery) recordEvent(ctx context.Context, timestamp pcommon.Timestamp, dbSystemNameAttributeValue string, dbQueryTextAttributeValue string, mysqlQueryPlanAttributeValue string, mysqlQueryPlanHashAttributeValue string, mysqlEventsStatementsSummaryByDigestDigestAttributeValue string, mysqlEventsStatementsSummaryByDigestCountStarAttributeValue int64, mysqlEventsStatementsSummaryByDigestSumTimerWaitAttributeValue float64) {
 	if !e.config.Enabled {
 		return
 	}
@@ -85,6 +86,7 @@ func (e *eventDbServerTopQuery) recordEvent(ctx context.Context, timestamp pcomm
 	dp.Attributes().PutStr("db.system.name", dbSystemNameAttributeValue)
 	dp.Attributes().PutStr("db.query.text", dbQueryTextAttributeValue)
 	dp.Attributes().PutStr("mysql.query_plan", mysqlQueryPlanAttributeValue)
+	dp.Attributes().PutStr("mysql.query_plan.hash", mysqlQueryPlanHashAttributeValue)
 	dp.Attributes().PutStr("mysql.events_statements_summary_by_digest.digest", mysqlEventsStatementsSummaryByDigestDigestAttributeValue)
 	dp.Attributes().PutInt("mysql.events_statements_summary_by_digest.count_star", mysqlEventsStatementsSummaryByDigestCountStarAttributeValue)
 	dp.Attributes().PutDouble("mysql.events_statements_summary_by_digest.sum_timer_wait", mysqlEventsStatementsSummaryByDigestSumTimerWaitAttributeValue)
@@ -223,11 +225,11 @@ func (lb *LogsBuilder) Emit(options ...ResourceLogsOption) plog.Logs {
 }
 
 // RecordDbServerQuerySampleEvent adds a log record of db.server.query_sample event.
-func (lb *LogsBuilder) RecordDbServerQuerySampleEvent(ctx context.Context, timestamp pcommon.Timestamp, dbSystemNameAttributeValue AttributeDbSystemName, mysqlThreadsThreadIDAttributeValue int64, userNameAttributeValue string, dbNamespaceAttributeValue string, mysqlThreadsProcesslistCommandAttributeValue string, mysqlThreadsProcesslistStateAttributeValue string, dbQueryTextAttributeValue string, mysqlEventsStatementsCurrentDigestAttributeValue string, mysqlEventIDAttributeValue int64, mysqlWaitTypeAttributeValue string, mysqlSessionStatusAttributeValue string, mysqlSessionIDAttributeValue int64, mysqlEventsWaitsCurrentTimerWaitAttributeValue float64, clientAddressAttributeValue string, clientPortAttributeValue int64, networkPeerAddressAttributeValue string, networkPeerPortAttributeValue int64) {
-	lb.eventDbServerQuerySample.recordEvent(ctx, timestamp, dbSystemNameAttributeValue.String(), mysqlThreadsThreadIDAttributeValue, userNameAttributeValue, dbNamespaceAttributeValue, mysqlThreadsProcesslistCommandAttributeValue, mysqlThreadsProcesslistStateAttributeValue, dbQueryTextAttributeValue, mysqlEventsStatementsCurrentDigestAttributeValue, mysqlEventIDAttributeValue, mysqlWaitTypeAttributeValue, mysqlSessionStatusAttributeValue, mysqlSessionIDAttributeValue, mysqlEventsWaitsCurrentTimerWaitAttributeValue, clientAddressAttributeValue, clientPortAttributeValue, networkPeerAddressAttributeValue, networkPeerPortAttributeValue)
+func (lb *LogsBuilder) RecordDbServerQuerySampleEvent(ctx context.Context, timestamp pcommon.Timestamp, dbSystemNameAttributeValue AttributeDbSystemName, mysqlThreadsThreadIDAttributeValue int64, userNameAttributeValue string, dbNamespaceAttributeValue string, mysqlThreadsProcesslistCommandAttributeValue string, mysqlThreadsProcesslistStateAttributeValue string, dbQueryTextAttributeValue string, mysqlEventsStatementsCurrentDigestAttributeValue string, mysqlQueryPlanHashAttributeValue string, mysqlEventIDAttributeValue int64, mysqlWaitTypeAttributeValue string, mysqlSessionStatusAttributeValue string, mysqlSessionIDAttributeValue int64, mysqlEventsWaitsCurrentTimerWaitAttributeValue float64, clientAddressAttributeValue string, clientPortAttributeValue int64, networkPeerAddressAttributeValue string, networkPeerPortAttributeValue int64) {
+	lb.eventDbServerQuerySample.recordEvent(ctx, timestamp, dbSystemNameAttributeValue.String(), mysqlThreadsThreadIDAttributeValue, userNameAttributeValue, dbNamespaceAttributeValue, mysqlThreadsProcesslistCommandAttributeValue, mysqlThreadsProcesslistStateAttributeValue, dbQueryTextAttributeValue, mysqlEventsStatementsCurrentDigestAttributeValue, mysqlQueryPlanHashAttributeValue, mysqlEventIDAttributeValue, mysqlWaitTypeAttributeValue, mysqlSessionStatusAttributeValue, mysqlSessionIDAttributeValue, mysqlEventsWaitsCurrentTimerWaitAttributeValue, clientAddressAttributeValue, clientPortAttributeValue, networkPeerAddressAttributeValue, networkPeerPortAttributeValue)
 }
 
 // RecordDbServerTopQueryEvent adds a log record of db.server.top_query event.
-func (lb *LogsBuilder) RecordDbServerTopQueryEvent(ctx context.Context, timestamp pcommon.Timestamp, dbSystemNameAttributeValue AttributeDbSystemName, dbQueryTextAttributeValue string, mysqlQueryPlanAttributeValue string, mysqlEventsStatementsSummaryByDigestDigestAttributeValue string, mysqlEventsStatementsSummaryByDigestCountStarAttributeValue int64, mysqlEventsStatementsSummaryByDigestSumTimerWaitAttributeValue float64) {
-	lb.eventDbServerTopQuery.recordEvent(ctx, timestamp, dbSystemNameAttributeValue.String(), dbQueryTextAttributeValue, mysqlQueryPlanAttributeValue, mysqlEventsStatementsSummaryByDigestDigestAttributeValue, mysqlEventsStatementsSummaryByDigestCountStarAttributeValue, mysqlEventsStatementsSummaryByDigestSumTimerWaitAttributeValue)
+func (lb *LogsBuilder) RecordDbServerTopQueryEvent(ctx context.Context, timestamp pcommon.Timestamp, dbSystemNameAttributeValue AttributeDbSystemName, dbQueryTextAttributeValue string, mysqlQueryPlanAttributeValue string, mysqlQueryPlanHashAttributeValue string, mysqlEventsStatementsSummaryByDigestDigestAttributeValue string, mysqlEventsStatementsSummaryByDigestCountStarAttributeValue int64, mysqlEventsStatementsSummaryByDigestSumTimerWaitAttributeValue float64) {
+	lb.eventDbServerTopQuery.recordEvent(ctx, timestamp, dbSystemNameAttributeValue.String(), dbQueryTextAttributeValue, mysqlQueryPlanAttributeValue, mysqlQueryPlanHashAttributeValue, mysqlEventsStatementsSummaryByDigestDigestAttributeValue, mysqlEventsStatementsSummaryByDigestCountStarAttributeValue, mysqlEventsStatementsSummaryByDigestSumTimerWaitAttributeValue)
 }
diff --git a/receiver/mysqlreceiver/metadata.yaml b/receiver/mysqlreceiver/metadata.yaml
index f57ce6020030c..8127c0fdc77fe 100644
--- a/receiver/mysqlreceiver/metadata.yaml
+++ b/receiver/mysqlreceiver/metadata.yaml
@@ -161,6 +161,9 @@ attributes:
   mysql.query_plan:
     description: The query plan for the statement, if available.
     type: string
+  mysql.query_plan.hash:
+    description: This attribute is set to the same value as mysql.events_statements_summary_by_digest.digest (query digest) by design.
+    type: string
   mysql.session.id:
     description: The unique identifier for the session associated with the event.
     type: int
@@ -290,6 +293,7 @@ events:
       - mysql.threads.processlist_state
       - db.query.text
       - mysql.events_statements_current.digest
+      - mysql.query_plan.hash
       - mysql.event_id
       - mysql.wait_type
       - mysql.session.status
@@ -309,6 +313,7 @@ events:
       - db.system.name
       - db.query.text
       - mysql.query_plan
+      - mysql.query_plan.hash
       - mysql.events_statements_summary_by_digest.digest
       - mysql.events_statements_summary_by_digest.count_star
       - mysql.events_statements_summary_by_digest.sum_timer_wait
diff --git a/receiver/mysqlreceiver/scraper.go b/receiver/mysqlreceiver/scraper.go
index 85faeaa3676fc..295d775d29a65 100644
--- a/receiver/mysqlreceiver/scraper.go
+++ b/receiver/mysqlreceiver/scraper.go
@@ -133,7 +133,7 @@ func (m *mySQLScraper) scrape(context.Context) (pmetric.Metrics, error) {
 
 func (m *mySQLScraper) scrapeTopQueryFunc(ctx context.Context) (plog.Logs, error) {
 	if m.sqlclient == nil {
-		return plog.NewLogs(), errors.New("failed to connect to http client")
+		return plog.NewLogs(), errors.New("failed to connect to MySQL client")
 	}
 
 	errs := &scrapererror.ScrapeErrors{}
@@ -150,7 +150,7 @@ func (m *mySQLScraper) scrapeTopQueryFunc(ctx context.Context) (plog.Logs, error
 
 func (m *mySQLScraper) scrapeQuerySampleFunc(ctx context.Context) (plog.Logs, error) {
 	if m.sqlclient == nil {
-		return plog.NewLogs(), errors.New("failed to connect to http client")
+		return plog.NewLogs(), errors.New("failed to connect to MySQL client")
 	}
 
 	errs := &scrapererror.ScrapeErrors{}
@@ -707,6 +707,7 @@ func (m *mySQLScraper) scrapeTopQueries(ctx context.Context, now pcommon.Timesta
 			obfuscatedQuery,
 			obfuscatedPlan,
 			q.digest,
+			q.digest,
 			countStarVal,
 			sumTimerWaitVal,
 		)
@@ -757,6 +758,7 @@ func (m *mySQLScraper) scrapeQuerySamples(ctx context.Context, now pcommon.Times
 			sample.processlistState,
 			obfuscatedQuery,
 			sample.digest,
+			sample.digest,
 			sample.eventID,
 			sample.waitEvent,
 			sample.sessionStatus,


Test patch:
diff --git a/receiver/mysqlreceiver/internal/metadata/generated_logs_test.go b/receiver/mysqlreceiver/internal/metadata/generated_logs_test.go
index 10e2061caf197..3f29beb118f10 100644
--- a/receiver/mysqlreceiver/internal/metadata/generated_logs_test.go
+++ b/receiver/mysqlreceiver/internal/metadata/generated_logs_test.go
@@ -129,10 +129,10 @@ func TestLogsBuilder(t *testing.T) {
 			allEventsCount := 0
 
 			allEventsCount++
-			lb.RecordDbServerQuerySampleEvent(ctx, timestamp, AttributeDbSystemNameMysql, 23, "user.name-val", "db.namespace-val", "mysql.threads.processlist_command-val", "mysql.threads.processlist_state-val", "db.query.text-val", "mysql.events_statements_current.digest-val", 14, "mysql.wait_type-val", "mysql.session.status-val", 16, 37.100000, "client.address-val", 11, "network.peer.address-val", 17)
+			lb.RecordDbServerQuerySampleEvent(ctx, timestamp, AttributeDbSystemNameMysql, 23, "user.name-val", "db.namespace-val", "mysql.threads.processlist_command-val", "mysql.threads.processlist_state-val", "db.query.text-val", "mysql.events_statements_current.digest-val", "mysql.query_plan.hash-val", 14, "mysql.wait_type-val", "mysql.session.status-val", 16, 37.100000, "client.address-val", 11, "network.peer.address-val", 17)
 
 			allEventsCount++
-			lb.RecordDbServerTopQueryEvent(ctx, timestamp, AttributeDbSystemNameMysql, "db.query.text-val", "mysql.query_plan-val", "mysql.events_statements_summary_by_digest.digest-val", 52, 56.100000)
+			lb.RecordDbServerTopQueryEvent(ctx, timestamp, AttributeDbSystemNameMysql, "db.query.text-val", "mysql.query_plan-val", "mysql.query_plan.hash-val", "mysql.events_statements_summary_by_digest.digest-val", 52, 56.100000)
 
 			rb := lb.NewResourceBuilder()
 			rb.SetMysqlInstanceEndpoint("mysql.instance.endpoint-val")
@@ -189,6 +189,9 @@ func TestLogsBuilder(t *testing.T) {
 					attrVal, ok = lr.Attributes().Get("mysql.events_statements_current.digest")
 					assert.True(t, ok)
 					assert.Equal(t, "mysql.events_statements_current.digest-val", attrVal.Str())
+					attrVal, ok = lr.Attributes().Get("mysql.query_plan.hash")
+					assert.True(t, ok)
+					assert.Equal(t, "mysql.query_plan.hash-val", attrVal.Str())
 					attrVal, ok = lr.Attributes().Get("mysql.event_id")
 					assert.True(t, ok)
 					assert.EqualValues(t, 14, attrVal.Int())
@@ -232,6 +235,9 @@ func TestLogsBuilder(t *testing.T) {
 					attrVal, ok = lr.Attributes().Get("mysql.query_plan")
 					assert.True(t, ok)
 					assert.Equal(t, "mysql.query_plan-val", attrVal.Str())
+					attrVal, ok = lr.Attributes().Get("mysql.query_plan.hash")
+					assert.True(t, ok)
+					assert.Equal(t, "mysql.query_plan.hash-val", attrVal.Str())
 					attrVal, ok = lr.Attributes().Get("mysql.events_statements_summary_by_digest.digest")
 					assert.True(t, ok)
 					assert.Equal(t, "mysql.events_statements_summary_by_digest.digest-val", attrVal.Str())
diff --git a/receiver/mysqlreceiver/scraper_test.go b/receiver/mysqlreceiver/scraper_test.go
index 447bca660fcdc..93e24d815c6f1 100644
--- a/receiver/mysqlreceiver/scraper_test.go
+++ b/receiver/mysqlreceiver/scraper_test.go
@@ -113,7 +113,7 @@ func TestScrape(t *testing.T) {
 		expectedTopQueries, err := golden.ReadLogs(expectedTopQueriesFile)
 		require.NoError(t, err)
 
-		require.NoError(t, plogtest.CompareLogs(actualTopQueries, expectedTopQueries,
+		require.NoError(t, plogtest.CompareLogs(expectedTopQueries, actualTopQueries,
 			plogtest.IgnoreTimestamp()))
 	})
 
diff --git a/receiver/mysqlreceiver/testdata/scraper/expectedQuerySamples.yaml b/receiver/mysqlreceiver/testdata/scraper/expectedQuerySamples.yaml
index da61b3c46ec8e..60eb402889272 100644
--- a/receiver/mysqlreceiver/testdata/scraper/expectedQuerySamples.yaml
+++ b/receiver/mysqlreceiver/testdata/scraper/expectedQuerySamples.yaml
@@ -27,6 +27,9 @@ resourceLogs:
               - key: mysql.events_statements_current.digest
                 value:
                   stringValue: aaaaaa
+              - key: mysql.query_plan.hash
+                value:
+                  stringValue: aaaaaa
               - key: mysql.event_id
                 value:
                   intValue: "17470257762"
diff --git a/receiver/mysqlreceiver/testdata/scraper/expectedTopQueries.yaml b/receiver/mysqlreceiver/testdata/scraper/expectedTopQueries.yaml
index 91edf251fc47a..4b4832760e3f2 100644
--- a/receiver/mysqlreceiver/testdata/scraper/expectedTopQueries.yaml
+++ b/receiver/mysqlreceiver/testdata/scraper/expectedTopQueries.yaml
@@ -13,6 +13,9 @@ resourceLogs:
                 value:
                   stringValue: |
                     {"query_block":{"select_id":1,"cost_info":{"query_cost":"?"},"ordering_operation":{"using_filesort":true,"table":{"table_name":"events_statements_summary_by_digest","access_type":"ALL","rows_examined_per_scan":"?","rows_produced_per_join":"?","filtered":"?","cost_info":{"read_cost":"?","eval_cost":"?","prefix_cost":"?","data_read_per_join":"?"},"used_columns":["SCHEMA_NAME","DIGEST","DIGEST_TEXT","COUNT_STAR","SUM_TIMER_WAIT","LAST_SEEN","QUERY_SAMPLE_TEXT"],"attached_condition":"( ( performance_schema . events_statements_summary_by_digest . LAST_SEEN >= < cache > ( ( now ( ) - interval ? second ) ) ) and ( ( ( not ( ( performance_schema . events_statements_summary_by_digest . DIGEST_TEXT like ? ) ) ) and ( not ( ( performance_schema . events_statements_summary_by_digest . DIGEST_TEXT like ? ) ) ) ) or ( performance_schema . events_statements_summary_by_digest . DIGEST_TEXT is ? ) ) )"}}}}
+              - key: mysql.query_plan.hash
+                value:
+                  stringValue: c16f24f908846019a741db580f6545a5933e9435a7cf1579c50794a6ca287739
               - key: mysql.events_statements_summary_by_digest.digest
                 value:
                   stringValue: c16f24f908846019a741db580f6545a5933e9435a7cf1579c50794a6ca287739
@@ -24,7 +27,7 @@ resourceLogs:
                   doubleValue: 0.001021918999
             body: {}
             eventName: db.server.top_query
-            timeUnixNano: "1754297675177556000"
+            timeUnixNano: "1774457850184558000"
         scope:
           name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mysqlreceiver
           version: latest