Rechercher dans le manuel MySQL

26.12.8 Performance Schema Connection Tables

When a client connects to the MySQL server, it does so under a particular user name and from a particular host. The Performance Schema provides statistics about these connections, tracking them per account (user and host combination) as well as separately per user name and host name, using these tables:

  • accounts: Connection statistics per client account

  • hosts: Connection statistics per client host name

  • users: Connection statistics per client user name

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:

  1. mysql> SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
  2.        WHERE TABLE_SCHEMA = 'performance_schema'
  3.        AND TABLE_NAME REGEXP '_summary_by_(account|host|user)'
  4.        ORDER BY TABLE_NAME;
  5. +------------------------------------------------------+
  6. | TABLE_NAME                                           |
  7. +------------------------------------------------------+
  8. | events_errors_summary_by_account_by_error            |
  9. | events_errors_summary_by_host_by_error               |
  10. | events_errors_summary_by_user_by_error               |
  11. | events_stages_summary_by_account_by_event_name       |
  12. | events_stages_summary_by_host_by_event_name          |
  13. | events_stages_summary_by_user_by_event_name          |
  14. | events_statements_summary_by_account_by_event_name   |
  15. | events_statements_summary_by_host_by_event_name      |
  16. | events_statements_summary_by_user_by_event_name      |
  17. | events_transactions_summary_by_account_by_event_name |
  18. | events_transactions_summary_by_host_by_event_name    |
  19. | events_transactions_summary_by_user_by_event_name    |
  20. | events_waits_summary_by_account_by_event_name        |
  21. | events_waits_summary_by_host_by_event_name           |
  22. | events_waits_summary_by_user_by_event_name           |
  23. | memory_summary_by_account_by_event_name              |
  24. | memory_summary_by_host_by_event_name                 |
  25. | memory_summary_by_user_by_event_name                 |
  26. +------------------------------------------------------+

For details about individual connection summary tables, consult the section that describes tables for the summarized event type:

TRUNCATE TABLE is permitted for connection summary tables. It removes rows for accounts, hosts, or users with no connections, and resets the summary columns to zero for the remaining rows. In addition, each summary table that is aggregated by account, host, user, or thread is implicitly truncated by truncation of the connection table on which it depends. The following table describes the relationship between connection table truncation and implicitly truncated tables.

Table 26.2 Implicit Effects of Connection Table Truncation

Truncated Connection Table Implicitly Truncated Summary Tables
accounts Tables with names containing _summary_by_account, _summary_by_thread
hosts Tables with names containing _summary_by_account, _summary_by_host, _summary_by_thread
users Tables with names containing _summary_by_account, _summary_by_user, _summary_by_thread

Truncating a _summary_global summary table also implicitly truncates its corresponding connection and thread summary tables. For example, truncating events_waits_summary_global_by_event_name implicitly truncates the wait event summary tables that are aggregated by account, host, user, or thread.


Suchen Sie im MySQL-Handbuch

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 26/06/2006, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/mysql-rf-performance-schema-connection-tables.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:en Manuel MySQL : https://dev.mysql.com/

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut