> For the complete documentation index, see [llms.txt](https://docs.euno.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.euno.ai/using-euno/usage-optimization/mysql-usage-data.md).

# MySQL Usage Data

Enable **Extract Usage Metrics** in the MySQL integration's **Advanced** settings to populate the resource Usage tab and standard EQL usage fields for discovered tables and views. The option is disabled by default. See [MySQL setup](/sources/data-warehouses/mysql-integration.md).

## Metrics and coverage

| Properties                                                                   | Source and meaning                                                                                                                                              |
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `total_read_queries_14d`, `total_read_queries_30d`, `total_read_queries_60d` | Read-query counts from retained statement digests whose bounds can be assigned to the window.                                                                   |
| `distinct_users_14d`, `distinct_users_30d`, `distinct_users_60d`             | Distinct MySQL users attributed to retained, timestamped history-long statements in the window.                                                                 |
| `last_accessed_at`                                                           | Latest retained read digest's `LAST_SEEN`.                                                                                                                      |
| `query_count`, `distinct_users`                                              | Legacy unwindowed metrics. `query_count` falls back to table I/O read operations when digest counts are unavailable; those operations are not query executions. |

Query counts include read sources of `SELECT`, `WITH`, `INSERT ... SELECT`, and `CREATE TABLE ... SELECT` statements. User counts deduplicate by MySQL username, not by connection or application user. Window boundaries are evaluated in UTC.

## Permissions

In addition to the catalog permissions in the setup guide, the integration user needs `SELECT` on these Performance Schema tables. A MySQL administrator can grant access as follows, adapting the account name and host to the integration user:

```sql
GRANT SELECT ON performance_schema.table_io_waits_summary_by_table TO 'euno_reader'@'%';
GRANT SELECT ON performance_schema.events_statements_summary_by_digest TO 'euno_reader'@'%';
GRANT SELECT ON performance_schema.events_statements_history_long TO 'euno_reader'@'%';
GRANT SELECT ON performance_schema.events_statements_current TO 'euno_reader'@'%';
GRANT SELECT ON performance_schema.threads TO 'euno_reader'@'%';
GRANT SELECT ON performance_schema.setup_consumers TO 'euno_reader'@'%';
GRANT SELECT ON performance_schema.setup_instruments TO 'euno_reader'@'%';
```

The crawler reads these settings; it does not enable collection or need `UPDATE` privileges.

## Performance Schema configuration

Performance Schema must be enabled on the server (`SELECT @@performance_schema` returns `1`). A MySQL administrator should configure these consumers for both query and user windows:

```sql
UPDATE performance_schema.setup_consumers
SET ENABLED = 'YES'
WHERE NAME IN ('global_instrumentation', 'statements_digest', 'thread_instrumentation',
               'events_statements_current', 'events_statements_history_long');

UPDATE performance_schema.setup_instruments
SET ENABLED = 'YES', TIMED = 'YES'
WHERE NAME IN ('statement/sql/select', 'statement/sql/insert_select', 'statement/sql/create_table',
               'statement/abstract/Query', 'statement/abstract/new_packet',
               'statement/com/Execute', 'statement/sql/execute_sql');
```

Query windows require global instrumentation, digest collection, and the listed instruments to be enabled. User windows independently require global and thread instrumentation, current-statement and history-long collection, and the listed instruments to be enabled and timed. The per-thread `events_statements_history` consumer is not a prerequisite for history-long collection. See MySQL's [consumer dependencies](https://dev.mysql.com/doc/refman/8.4/en/performance-schema-consumer-filtering.html) and [instrument timing settings](https://dev.mysql.com/doc/refman/8.4/en/performance-schema-setup-instruments-table.html).

Verify the configuration with `SELECT * FROM performance_schema.setup_consumers` and `SELECT NAME, ENABLED, TIMED FROM performance_schema.setup_instruments WHERE NAME LIKE 'statement/%'`. MySQL 8.4 normally disables history-long collection; enabling it starts collecting new events. Arrange persistent startup configuration with your administrator because runtime updates do not survive a restart. Consult MySQL's [statement event configuration](https://dev.mysql.com/doc/refman/8.4/en/performance-schema-statement-tables.html).

## Retention and unavailable values

These metrics describe retained evidence, not a guaranteed complete 60-day audit history:

* Digests accumulate counts between resets. If a digest spans a window's cutoff, Euno cannot split its count accurately and omits that table's affected window. This is normal on long-running servers. Digests entirely before the cutoff contribute zero; digests entirely inside it contribute their counts.
* Server restarts, resets, and digest eviction shorten coverage. Enabling collection does not restore earlier events. Do not reset Performance Schema just to make a window available.
* History-long is a bounded event buffer. Busy workloads can overwrite events well before 14 days. User attribution also requires the original connection's thread to still exist, so disconnected users can be absent. Thread/actor filters can further limit coverage.
* Statement times are estimated from Performance Schema timers and the crawler's current statement. Missing timing for a table prevents publication of its user windows.
* Missing evidence, disabled required collection, or unreadable configuration leaves affected window properties unchanged in Euno. Stored values can therefore describe an earlier crawl. Disabling the integration option also preserves prior metrics.

A published zero means no matching activity in the usable retained evidence. It does not prove that a table had no activity during the entire calendar window. Missing metrics likewise do not mean zero usage. Check source coverage before using these values to decide that a resource is unused.

Access failures, disabled required collection, and relevant unparseable statements appear as non-fatal discovery errors. Unavailable query windows caused by digest bounds do not produce a run warning.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.euno.ai/using-euno/usage-optimization/mysql-usage-data.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
