The meaning of “account”  in the connection tables is similar to its meaning in the MySQL grant tables in the mysql  system database, in the sense that the term refers to a combination of user and host values. They differ in that, for grant tables, the host part of an account can be a pattern, whereas for Performance Schema tables, the host value is always a specific nonpattern host name. 

Each connection table has CURRENT_CONNECTIONS  and TOTAL_CONNECTIONS  columns to track the current and total number of connections per “tracking value”  on which its statistics are based. The tables differ in what they use for the tracking value. The accounts  table has USER  and HOST  columns to track connections per user and host combination. The users  and hosts  tables have a USER  and HOST  column, respectively, to track connections per user name and host name. 

The Performance Schema also counts internal threads and threads for user sessions that failed to authenticate, using rows with USER  and HOST  column values of NULL . 

Suppose that clients named user1  and user2  each connect one time from hosta  and hostb . The Performance Schema tracks the connections as follows: 

•The accounts  table has four rows, for the user1 / hosta , user1 / hostb , user2 / hosta , and user2 / hostb  account values, each row counting one connection per account. 

•The hosts  table has two rows, for hosta  and hostb , each row counting two connections per host name. 

•The users  table has two rows, for user1  and user2 , each row counting two connections per user name. 

When a client connects, the Performance Schema determines which row in each connection table applies, using the tracking value appropriate to each table. If there is no such row, one is added. Then the Performance Schema increments by one the CURRENT_CONNECTIONS  and TOTAL_CONNECTIONS columns in that row. 

When a client disconnects, the Performance Schema decrements by one the CURRENT_CONNECTIONS column in the row and leaves the TOTAL_CONNECTIONS  column unchanged. 

TRUNCATE TABLE  is permitted for connection tables. It has these effects: 

•Rows are removed for accounts, hosts, or users that have no current connections (rows with CURRENT_CONNECTIONS = 0 ). 

•Nonremoved rows are reset to count only current connections: For rows with CURRENT_CONNECTIONS > 0 , TOTAL_CONNECTIONS  is reset to CURRENT_CONNECTIONS . 

•Summary tables that depend on the connection table are implicitly truncated, as described later in this section. 

The Performance Schema maintains summary tables that aggregate connection statistics for various event types by account, host, or user. These tables have _summary_by_account , _summary_by_host , or _summary_by_user  in the name. To identify them, use this query: 

mysql> SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ’performance_schema’ AND TABLE_NAME REGEXP ’_summary_by_(account|host|user)’ ORDER BY TABLE_NAME; +------------------------------------------------------+ | TABLE_NAME | +------------------------------------------------------+ | events_errors_summary_by_account_by_error | | events_errors_summary_by_host_by_error | | events_errors_summary_by_user_by_error | 

