Bug #92532 | Contribution by Facebook: Performance schema for Query attributes | ||
---|---|---|---|
Submitted: | 21 Sep 2018 16:26 | Modified: | 18 Jan 2021 12:26 |
Reporter: | FBContrib Admin | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Performance Schema | Severity: | S3 (Non-critical) |
Version: | 8.0.11 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[21 Sep 2018 16:26]
FBContrib Admin
[21 Sep 2018 16:26]
FBContrib Admin
Performance schema for Query attributes (*) This code is contributed under the Facebook agreement
Contribution: fb_patch_82.txt (text/plain), 39.42 KiB.
[2 Oct 2018 21:07]
FBContrib Admin
Implemented measuring CPU usage for queries instrumented with query attributes (*) This code is contributed under the Facebook agreement
Contribution: fb_patch_84.txt (text/plain), 40.25 KiB.
[2 Oct 2018 21:11]
Omer Barnir
Additional information related to the second part of the contribution (fb_patch_84.txt): These patches contain the changes which affect the performance_schema table for query attributes too. Implemented measuring CPU usage for queries instrumented with query attributes. Added system table QUERY_PERF_COUNTER to output results of measurements. Repo: https://github.com/mysql/mysql-server Patch on top of 8.0.11: https://github.com/mysql/mysql-server/commit/8.0 Facebook commits: - https://github.com/facebook/mysql-5.6/commit/5832232 - https://github.com/facebook/mysql-5.6/commit/453353b
[18 Jan 2021 8:16]
Georgi Kodinov
Implemented as WL#12542 in 8.0.23
[18 Jan 2021 12:26]
Paul DuBois
Posted by developer: Fixed in 8.0.23. For some applications, it may be useful to define metadata on a per-query basis. Examples include the URL of the page that produced a query, or extra processing information to be passed with a query for use by a plugin such as an audit plugin or query rewrite plugin. MySQL now supports this capability without the use of workarounds such as specially formatted comments included in query strings: * On the client side, the mysql_bind_param() C API function enables defining query attributes. These attributes apply to the next SQL statement sent to the server for execution. Additionally, the mysql and mysqltest clients have a query_attributes command that enables defining query attributes. * On the server side, a component service provides access to query attributes. A component named query_attributes uses this service to implement a mysql_query_attribute_string() user-defined function (UDF) that enables obtaining attribute values within SQL statements. The query_attributes component is optional but must be installed for the UDF to be available. Thanks to Facebook for suggesting the idea (and for contributing code, although it was not used).