## 27.16 性能模式状态变量

Performance Schema 实现了几个状态变量，这些变量提供有关由于内存限制而无法加载或创建的检测的信息：

```
mysql> SHOW STATUS LIKE 'perf%';
+-------------------------------------------+-------+
| Variable_name                             | Value |
+-------------------------------------------+-------+
| Performance_schema_accounts_lost          | 0     |
| Performance_schema_cond_classes_lost      | 0     |
| Performance_schema_cond_instances_lost    | 0     |
| Performance_schema_file_classes_lost      | 0     |
| Performance_schema_file_handles_lost      | 0     |
| Performance_schema_file_instances_lost    | 0     |
| Performance_schema_hosts_lost             | 0     |
| Performance_schema_locker_lost            | 0     |
| Performance_schema_mutex_classes_lost     | 0     |
| Performance_schema_mutex_instances_lost   | 0     |
| Performance_schema_rwlock_classes_lost    | 0     |
| Performance_schema_rwlock_instances_lost  | 0     |
| Performance_schema_socket_classes_lost    | 0     |
| Performance_schema_socket_instances_lost  | 0     |
| Performance_schema_stage_classes_lost     | 0     |
| Performance_schema_statement_classes_lost | 0     |
| Performance_schema_table_handles_lost     | 0     |
| Performance_schema_table_instances_lost   | 0     |
| Performance_schema_thread_classes_lost    | 0     |
| Performance_schema_thread_instances_lost  | 0     |
| Performance_schema_users_lost             | 0     |
+-------------------------------------------+-------+
```

有关使用这些变量检查性能模式状态的信息，请参阅[第 27.7 节，“性能模式状态监控”](performance-schema-status-monitoring.html).

Performance Schema 状态变量的含义如下：

-   [](<>) [`Performance_schema_accounts_lost`](performance-schema-status-variables.html#statvar_Performance_schema_accounts_lost)

    [](<>)[](<>)

    一行无法添加到[`帐户`](performance-schema-accounts-table.html)表，因为它已满。

-   [](<>) [`Performance_schema_cond_classes_lost`](performance-schema-status-variables.html#statvar_Performance_schema_cond_classes_lost)

    [](<>)[](<>)

    无法加载多少条件仪器。

-   [](<>) [`Performance_schema_cond_instances_lost`](performance-schema-status-variables.html#statvar_Performance_schema_cond_instances_lost)

    [](<>)[](<>)

    无法创建多少条件仪表实例。

-   [](<>) [`Performance_schema_digest_lost`](performance-schema-status-variables.html#statvar_Performance_schema_digest_lost)

    [](<>)[](<>)

    无法在[`events_statements_summary_by_digest`](performance-schema-statement-summary-tables.html)桌子。如果值为[`performance_schema_digests_size`](performance-schema-system-variables.html#sysvar_performance_schema_digests_size)太小。

-   [](<>) [`Performance_schema_file_classes_lost`](performance-schema-status-variables.html#statvar_Performance_schema_file_classes_lost)

    [](<>)[](<>)

    无法加载多少文件工具。

-   [](<>) [`Performance_schema_file_handles_lost`](performance-schema-status-variables.html#statvar_Performance_schema_file_handles_lost)

    [](<>)[](<>)

    有多少文件工具实例无法打开。

-   [](<>) [`Performance_schema_file_instances_lost`](performance-schema-status-variables.html#statvar_Performance_schema_file_instances_lost)

    [](<>)[](<>)

    无法创建多少文件工具实例。

-   [](<>) [`Performance_schema_hosts_lost`](performance-schema-status-variables.html#statvar_Performance_schema_hosts_lost)

    [](<>)[](<>)

    一行无法添加到[`主机`](performance-schema-hosts-table.html)表，因为它已满。

-   [](<>) [`Performance_schema_index_stat_lost`](performance-schema-status-variables.html#statvar_Performance_schema_index_stat_lost)

    [](<>)[](<>)

    丢失统计信息的索引数。如果值为[`performance_schema_max_index_stat`](performance-schema-system-variables.html#sysvar_performance_schema_max_index_stat)太小。

-   [](<>) [`Performance_schema_locker_lost`](performance-schema-status-variables.html#statvar_Performance_schema_locker_lost)

    [](<>)[](<>)

    由于以下条件，有多少事件“丢失”或未记录：

    -   事件是递归的（例如，等待 A 导致在 B 上等待，这导致在 C 上等待）。

    -   嵌套事件堆栈的深度大于实现所施加的限制。

        Performance Schema 记录的事件不是递归的，因此该变量应始终为 0。

-   [](<>) [`Performance_schema_memory_classes_lost`](performance-schema-status-variables.html#statvar_Performance_schema_memory_classes_lost)

    [](<>)[](<>)

    无法加载记忆工具的次数。

-   [](<>) [`Performance_schema_metadata_lock_lost`](performance-schema-status-variables.html#statvar_Performance_schema_metadata_lock_lost)

    [](<>)[](<>)

    无法在[`元数据锁`](performance-schema-metadata-locks-table.html)桌子。如果值为[`performance_schema_max_metadata_locks`](performance-schema-system-variables.html#sysvar_performance_schema_max_metadata_locks)太小。

-   [](<>) [`Performance_schema_mutex_classes_lost`](performance-schema-status-variables.html#statvar_Performance_schema_mutex_classes_lost)

    [](<>)[](<>)

    无法加载多少互斥仪器。

-   [](<>) [`Performance_schema_mutex_instances_lost`](performance-schema-status-variables.html#statvar_Performance_schema_mutex_instances_lost)

    [](<>)[](<>)

    无法创建多少互斥仪器实例。

-   [](<>) [`Performance_schema_nested_statement_lost`](performance-schema-status-variables.html#statvar_Performance_schema_nested_statement_lost)

    [](<>)[](<>)

    丢失统计信息的存储程序语句的数量。如果值为[`performance_schema_max_statement_stack`](performance-schema-system-variables.html#sysvar_performance_schema_max_statement_stack)太小。

-   [](<>) [`Performance_schema_prepared_statements_lost`](performance-schema-status-variables.html#statvar_Performance_schema_prepared_statements_lost)

    [](<>)[](<>)

    无法在[`prepared_statements_instances`](performance-schema-prepared-statements-instances-table.html)桌子。如果值为[`performance_schema_max_prepared_statements_instances`](performance-schema-system-variables.html#sysvar_performance_schema_max_prepared_statements_instances)太小。

-   [](<>) [`Performance_schema_program_lost`](performance-schema-status-variables.html#statvar_Performance_schema_program_lost)

    [](<>)[](<>)

    丢失统计信息的已存储程序的数量。如果值为[`performance_schema_max_program_instances`](performance-schema-system-variables.html#sysvar_performance_schema_max_program_instances)太小。

-   [](<>) [`Performance_schema_rwlock_classes_lost`](performance-schema-status-variables.html#statvar_Performance_schema_rwlock_classes_lost)

    [](<>)[](<>)

    无法加载多少个 rwlock 工具。

-   [](<>) [`Performance_schema_rwlock_instances_lost`](performance-schema-status-variables.html#statvar_Performance_schema_rwlock_instances_lost)

    [](<>)[](<>)

    无法创建多少个 rwlock 仪器实例。

-   [](<>) [`Performance_schema_session_connect_attrs_longest_seen`](performance-schema-status-variables.html#statvar_Performance_schema_session_connect_attrs_longest_seen)

    [](<>)[](<>)

    除了 Performance Schema 针对[`performance_schema_session_connect_attrs_size`](performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size)系统变量，服务器执行初步检查，将其接受的连接属性数据的聚合大小限制为 64KB。如果客户端尝试发送超过 64KB 的属性数据，服务器将拒绝连接。否则，服务器认为属性缓冲区有效并跟踪最长的缓冲区的大小。[`Performance_schema_session_connect_attrs_longest_seen`](performance-schema-status-variables.html#statvar_Performance_schema_session_connect_attrs_longest_seen)状态变量。如果这个值大于[`performance_schema_session_connect_attrs_size`](performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size)，DBA 可能希望增加后一个值，或者，调查哪些客户端正在发送大量属性数据。

    有关连接属性的详细信息，请参阅[第 27.12.9 节，“性能模式连接属性表”](performance-schema-connection-attribute-tables.html).

-   [](<>) [`Performance_schema_session_connect_attrs_lost`](performance-schema-status-variables.html#statvar_Performance_schema_session_connect_attrs_lost)

    [](<>)[](<>)

    发生连接属性截断的连接数。对于给定的连接，如果客户端发送的连接属性键值对的聚合大小大于[`performance_schema_session_connect_attrs_size`](performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size)系统变量，Performance Schema 截断属性数据并递增[`Performance_schema_session_connect_attrs_lost`](performance-schema-status-variables.html#statvar_Performance_schema_session_connect_attrs_lost).如果此值非零，您可能希望设置[`performance_schema_session_connect_attrs_size`](performance-schema-system-variables.html#sysvar_performance_schema_session_connect_attrs_size)到更大的值。

    有关连接属性的详细信息，请参阅[第 27.12.9 节，“性能模式连接属性表”](performance-schema-connection-attribute-tables.html).

-   [](<>) [`Performance_schema_socket_classes_lost`](performance-schema-status-variables.html#statvar_Performance_schema_socket_classes_lost)

    [](<>)[](<>)

    无法加载多少插座仪器。

-   [](<>) [`Performance_schema_socket_instances_lost`](performance-schema-status-variables.html#statvar_Performance_schema_socket_instances_lost)

    [](<>)[](<>)

    无法创建多少个套接字工具实例。

-   [](<>) [`Performance_schema_stage_classes_lost`](performance-schema-status-variables.html#statvar_Performance_schema_stage_classes_lost)

    [](<>)[](<>)

    无法加载多少舞台乐器。

-   [](<>) [`Performance_schema_statement_classes_lost`](performance-schema-status-variables.html#statvar_Performance_schema_statement_classes_lost)

    [](<>)[](<>)

    无法加载多少报表工具。

-   [](<>) [`Performance_schema_table_handles_lost`](performance-schema-status-variables.html#statvar_Performance_schema_table_handles_lost)

    [](<>)[](<>)

    有多少台仪器实例无法打开。如果值为[`performance_schema_max_table_handles`](performance-schema-system-variables.html#sysvar_performance_schema_max_table_handles)太小。

-   [](<>) [`Performance_schema_table_instances_lost`](performance-schema-status-variables.html#statvar_Performance_schema_table_instances_lost)

    [](<>)[](<>)

    无法创建多少台仪器实例。

-   [](<>) [`Performance_schema_table_lock_stat_lost`](performance-schema-status-variables.html#statvar_Performance_schema_table_lock_stat_lost)

    [](<>)[](<>)

    丢失锁定统计信息的表数。如果值为[`performance_schema_max_table_lock_stat`](performance-schema-system-variables.html#sysvar_performance_schema_max_table_lock_stat)太小。

-   [](<>) [`Performance_schema_thread_classes_lost`](performance-schema-status-variables.html#statvar_Performance_schema_thread_classes_lost)

    [](<>)[](<>)

    无法加载多少线程工具。

-   [](<>) [`Performance_schema_thread_instances_lost`](performance-schema-status-variables.html#statvar_Performance_schema_thread_instances_lost)

    [](<>)[](<>)

    无法在[`线程`](performance-schema-threads-table.html)桌子。如果值为[`performance_schema_max_thread_instances`](performance-schema-system-variables.html#sysvar_performance_schema_max_thread_instances)太小。

-   [](<>) [`Performance_schema_users_lost`](performance-schema-status-variables.html#statvar_Performance_schema_users_lost)

    [](<>)[](<>)

    一行无法添加到[`用户`](performance-schema-users-table.html)表，因为它已满。
