Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 35.1Mb
PDF (A4) - 35.1Mb
PDF (RPM) - 34.1Mb
EPUB - 8.6Mb
HTML Download (TGZ) - 8.3Mb
HTML Download (Zip) - 8.4Mb
HTML Download (RPM) - 7.2Mb
Eclipse Doc Plugin (TGZ) - 9.2Mb
Eclipse Doc Plugin (Zip) - 11.3Mb
Man Pages (TGZ) - 200.2Kb
Man Pages (Zip) - 305.4Kb
Info (Gzip) - 3.3Mb
Info (Zip) - 3.3Mb
Excerpts from this Manual

MySQL 5.7 Reference Manual  /  ...  /  Performance Schema Connection Attribute Tables

23.9.9 Performance Schema Connection Attribute Tables

Application programs can provide key/value pairs as connection attributes to be passed to the server at connect time. For the C API, define the attribute set using the mysql_options() and mysql_options4() functions. Other MySQL Connectors may provide their own attribute-definition methods.

These tables expose attribute information:

Attribute names that begin with an underscore (_) are reserved for internal use and should not be created by application programs. This convention permits new attributes to be introduced by MySQL without colliding with application attributes.

The set of connection attributes visible on a given connection varies depending on your platform and MySQL Connector used to establish the connection.

The libmysqlclient client library (provided in MySQL and MySQL Connector/C distributions) sets these attributes:

  • _client_name: The client name (libmysql for the client library)

  • _client_version: The client library version

  • _os: The operating system (for example, Linux, Win64)

  • _pid: The client process ID

  • _platform: The machine platform (for example, x86_64)

  • _thread: The client thread ID (Windows only)

Other MySQL Connectors may define their own connection attributes.

MySQL Connector/J defines these attributes:

  • _client_license: The connector license type

  • _runtime_vendor: The Java runtime environment (JRE) vendor

  • _runtime_version: The Java runtime environment (JRE) version

MySQL Connector/Net defines these attributes:

  • _client_version: The client library version

  • _os: The operating system (for example, Linux, Win64)

  • _pid: The client process ID

  • _platform: The machine platform (for example, x86_64)

  • _program_name: The client name

  • _thread: The client thread ID (Windows only)

PHP defines attributes that depend on how it was compiled:

  • Compiled using libmysqlclient: The standard libmysqlclient attributes, described previously

  • Compiled using mysqlnd: Only the _client_name attribute, with a value of mysqlnd

Many MySQL client programs set a program_name attribute with a value equal to the client name. For example, mysqladmin and mysqldump set program_name to mysqladmin and mysqldump, respectively.

Some MySQL client programs define additional attributes:

  • mysqlbinlog defines the _client_role attribute as binary_log_listener.

  • Replication slave connections define program_name as mysqld, _client_role as binary_log_listener, and _client_replication_channel_name as the channel name.

  • FEDERATED storage engine connections define program_name as mysqld and _client_role as federated_storage.

There are limits on the amount of connection attribute data transmitted from client to server: A fixed limit imposed by the client prior to connect time; a fixed limit imposed by the server at connect time; and a configurable limit imposed by the Performance Schema at connect time.

For connections initiated using the C API, the libmysqlclient library imposes a limit of 64KB on the aggregate size of connection attribute data on the client side: Calls to mysql_options() that cause this limit to be exceeded produce a CR_INVALID_PARAMETER_NO error. Other MySQL Connectors may impose their own client-side limits on how much connection attribute data can be transmitted to the server.

On the server side, these size checks on connection attribute data occur:

  • The server imposes a limit of 64KB on the aggregate size of connection attribute data it will accept. If a client attempts to send more than 64KB of attribute data, the server rejects the connection.

  • For accepted connections, the Performance Schema checks aggregate attribute size against the value of the performance_schema_session_connect_attrs_size system variable. If attribute size exceeds this value, these actions take place:

    • The Performance Schema truncates the attribute data and increments the Performance_schema_session_connect_attrs_lost status variable, which indicates the number of connections for which attribute truncation occurred.

    • The Performance Schema writes a message to the error log if the log_warnings system variable is greater than zero:

      [Warning] Connection attributes of length N were truncated
      

User Comments
Sign Up Login You must be logged in to post a comment.