Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql-compatibility: correct performance_schema statement #19737

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mysql-compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ As shown, because of the shared allocator, the `id` increments by 2 each time. T

<CustomContent platform="tidb">

TiDB utilizes a combination of [Prometheus and Grafana](/tidb-monitoring-api.md) for storing and querying performance monitoring metrics. In TiDB, performance schema tables do not return any results.
TiDB utilizes a combination of [Prometheus and Grafana](/tidb-monitoring-api.md) for storing and querying performance monitoring metrics. In TiDB, most [performance schema tables](/performance-schema/performance-schema.md) do not return any results.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this update also apply to the custom content for TiDB Cloud?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

mysql-5.7.28-TiDB-Serverless> TABLE performance_schema.session_variables LIMIT 5;
+-----------------------------------+----------------+
| VARIABLE_NAME                     | VARIABLE_VALUE |
+-----------------------------------+----------------+
| innodb_io_capacity_max            | 2000           |
| tidb_non_prepared_plan_cache_size | 100            |
| version_compile_os                | linux          |
| net_retry_count                   | 10             |
| tidb_current_ts                   | 0              |
+-----------------------------------+----------------+
5 rows in set (0.04 sec)

mysql-5.7.28-TiDB-Serverless> SELECT TIDB_VERSION()\G
*************************** 1. row ***************************
TIDB_VERSION(): Release Version: v7.1.3-serverless
Edition: Community
Git Commit Hash: 2e8be50b073c26b8979c6988a3888ce57b5cec99
Git Branch: release-7.1-serverless
UTC Build Time: 2024-11-22 15:30:17
GoVersion: go1.21.11
Race Enabled: false
TiKV Min Version: 6.1.0
Check Table Before Drop: false
Store: tikv
1 row in set (0.02 sec)

So performance_schema.session_variables is not empty.

performance_schema.session_connect_attrs doesn't exist on TiDB Cloud Serverless, which is because v7.1.3 doesn't yet have this table. TiDB v7.5 does have this table.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like session_variables was introduced in v6.2.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On TiDB Cloud Serverless this is the only table with data.

$ mysqldump -u '4BFMphWRTf5tr4V.root' -h gateway01.eu-central-1.prod.aws.tidbcloud.com -P 4000 -pXXXXXXXXXX --skip-lock-tables --no-create-info performance_schema | awk '/^INSERT/ { print substr($0,0,100) }'
mysqldump: [Warning] Using a password on the command line interface can be insecure.
-- Warning: column statistics not supported by the server.
INSERT INTO `session_variables` VALUES ('tidb_build_stats_concurrency','4'),('tidb_opt_skew_distinct

On TiDB Cloud Dedicated there are most likely more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dveeden Then it seems that we also need to update line 146? Performance schema tables return empty results in TiDB.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lilin90 correct. I've pushed a commit to update that line.


</CustomContent>

<CustomContent platform="tidb-cloud">

To check performance metrics in TiDB Cloud, you can either check the cluster overview page on the TiDB Cloud console or use [third-party monitoring integrations](/tidb-cloud/third-party-monitoring-integrations.md). Performance schema tables return empty results in TiDB.
To check performance metrics in TiDB Cloud, you can either check the cluster overview page in the TiDB Cloud console or use [third-party monitoring integrations](/tidb-cloud/third-party-monitoring-integrations.md). Most [performance schema tables](/performance-schema/performance-schema.md) return empty results in TiDB.

</CustomContent>

Expand Down
Loading