# mysql/mysql-sys architecture

> Architecture diagram of the GitHub repository mysql/mysql-sys, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mysql/mysql-sys
- Repository: https://github.com/mysql/mysql-sys

## Overview

MySQL sys schema is an administrator-facing collection of SQL views, functions, and procedures for inspecting database usage. The principal workflow is an administrator querying a sys view for formatted summaries of Performance Schema and Information Schema data. Other documented capabilities include Performance Schema setup and tracing, statement analysis and diagnostics, and persistent configuration. The tree supports grouping these modules by domain, but no source excerpts were provided, so undocumented calls and data dependencies are omitted; edges cite README statements only.

Main entry points: [`tables/sys_config.sql`](https://github.com/mysql/mysql-sys/blob/master/tables/sys_config.sql) (sys_config), [`views/p_s`](https://github.com/mysql/mysql-sys/tree/master/views/p_s) (Performance summaries), [`views/i_s`](https://github.com/mysql/mysql-sys/tree/master/views/i_s) (Schema and InnoDB views), [`procedures/diagnostics.sql`](https://github.com/mysql/mysql-sys/blob/master/procedures/diagnostics.sql) (Diagnostics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reporting["Usage reporting"]
  node_psviews["Performance summaries"]
  node_isviews["Schema and InnoDB views"]
  node_versionview["Version view<br/>[version.sql]"]
end

subgraph group_management["Performance management"]
  node_pssetup["Instrumentation setup"]
  node_pstrace["Statement and thread tracing"]
  node_pshelpers["Performance helpers"]
end

subgraph group_analysis["Diagnostics and analysis"]
  node_statementanalysis["Statement analyzer"]
  node_diagnostics["Diagnostics<br/>[diagnostics.sql]"]
end

subgraph group_config["Configuration and helpers"]
  node_configtable[("sys_config<br/>[sys_config.sql]")]
  node_configdata["Config defaults"]
  node_configtrigger["Config user triggers"]
  node_configfunction["Configuration lookup<br/>[sys_get_config.sql]"]
  node_sqlhelpers["Formatting and utility functions"]
end

node_admin(("Administrator"))
node_psource[("Performance Schema")]
node_isource[("Information Schema")]

node_admin -->|"queries"| node_psviews
node_admin -->|"queries"| node_isviews
node_admin -->|"queries"| node_versionview
node_admin -->|"runs"| node_pssetup
node_admin -->|"runs"| node_pstrace
node_admin -->|"runs"| node_statementanalysis
node_admin -->|"runs"| node_diagnostics
node_admin -->|"uses"| node_pshelpers
node_admin -->|"uses"| node_sqlhelpers
node_admin -->|"configures"| node_configtable
node_configfunction -->|"reads"| node_configtable
node_configtrigger -->|"maintains user"| node_configtable
node_diagnostics -.->|"may scan"| node_isource
node_psviews -->|"summarizes"| node_psource
node_isviews -.->|"reports"| node_isource
node_configtable -->|"persists options"| node_configdata

click node_psviews "https://github.com/mysql/mysql-sys/tree/master/views/p_s"
click node_isviews "https://github.com/mysql/mysql-sys/tree/master/views/i_s"
click node_versionview "https://github.com/mysql/mysql-sys/blob/master/views/version.sql"
click node_pssetup "https://github.com/mysql/mysql-sys/tree/master/procedures"
click node_pstrace "https://github.com/mysql/mysql-sys/tree/master/procedures"
click node_pshelpers "https://github.com/mysql/mysql-sys/tree/master/functions"
click node_statementanalysis "https://github.com/mysql/mysql-sys/blob/master/procedures/statement_performance_analyzer.sql"
click node_diagnostics "https://github.com/mysql/mysql-sys/blob/master/procedures/diagnostics.sql"
click node_configtable "https://github.com/mysql/mysql-sys/blob/master/tables/sys_config.sql"
click node_configdata "https://github.com/mysql/mysql-sys/blob/master/tables/sys_config_data.sql"
click node_configtrigger "https://github.com/mysql/mysql-sys/tree/master/triggers"
click node_configfunction "https://github.com/mysql/mysql-sys/blob/master/functions/sys_get_config.sql"
click node_sqlhelpers "https://github.com/mysql/mysql-sys/tree/master/functions"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_psviews,node_isviews,node_versionview toneBlue
class node_pssetup,node_pstrace,node_pshelpers,node_psource,node_isource toneAmber
class node_statementanalysis,node_diagnostics toneMint
class node_configtable,node_configdata,node_configtrigger,node_configfunction,node_sqlhelpers toneRose
class node_admin toneIndigo
```

## Components

### Usage reporting

- [Performance summaries](https://github.com/mysql/mysql-sys/tree/master/views/p_s): `views/p_s`
- [Schema and InnoDB views](https://github.com/mysql/mysql-sys/tree/master/views/i_s): `views/i_s`
- [Version view](https://github.com/mysql/mysql-sys/blob/master/views/version.sql): `views/version.sql`

### Performance management

- [Instrumentation setup](https://github.com/mysql/mysql-sys/tree/master/procedures): `procedures`
- [Statement and thread tracing](https://github.com/mysql/mysql-sys/tree/master/procedures): `procedures`
- [Performance helpers](https://github.com/mysql/mysql-sys/tree/master/functions): `functions`

### Diagnostics and analysis

- [Statement analyzer](https://github.com/mysql/mysql-sys/blob/master/procedures/statement_performance_analyzer.sql): `procedures/statement_performance_analyzer.sql`
- [Diagnostics](https://github.com/mysql/mysql-sys/blob/master/procedures/diagnostics.sql): `procedures/diagnostics.sql`

### Configuration and helpers

- [sys_config](https://github.com/mysql/mysql-sys/blob/master/tables/sys_config.sql): `tables/sys_config.sql`
- [Config defaults](https://github.com/mysql/mysql-sys/blob/master/tables/sys_config_data.sql): `tables/sys_config_data.sql`
- [Config user triggers](https://github.com/mysql/mysql-sys/tree/master/triggers): `triggers`
- [Configuration lookup](https://github.com/mysql/mysql-sys/blob/master/functions/sys_get_config.sql): `functions/sys_get_config.sql`
- [Formatting and utility functions](https://github.com/mysql/mysql-sys/tree/master/functions): `functions`

### Other components

- **Administrator**
- **Performance Schema**
- **Information Schema**

## Connections

- Administrator → Performance summaries: queries (evidence: `README.md`)
- Administrator → Schema and InnoDB views: queries (evidence: `README.md`)
- Administrator → Version view: queries (evidence: `README.md`)
- Administrator → Instrumentation setup: runs (evidence: `README.md`)
- Administrator → Statement and thread tracing: runs (evidence: `README.md`)
- Administrator → Statement analyzer: runs (evidence: `README.md`)
- Administrator → Diagnostics: runs (evidence: `README.md`)
- Administrator → Performance helpers: uses (evidence: `README.md`)
- Administrator → Formatting and utility functions: uses (evidence: `README.md`)
- Administrator → sys_config: configures (evidence: `README.md`)
- Configuration lookup → sys_config: reads (evidence: `README.md`)
- Config user triggers → sys_config: maintains user (evidence: `README.md`)
- Diagnostics → Information Schema: may scan (evidence: `README.md`)
- Performance summaries → Performance Schema: summarizes (evidence: `README.md`)
- Schema and InnoDB views → Information Schema: reports (evidence: `README.md`)
- sys_config → Config defaults: persists options (evidence: `README.md`)
