pingcap / pingcap/tidb

The tidb cpu usage is high due to the concurrent query of information_schema.tables

Open
#45,015 1 comment 0 reactions 1 assignee Claimed by @hawkingrei View on GitHub
component/statistics sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement
The tidb cpu usage is high due to the concurrent query of information_schema.tables.statscache lock consume many cpu resouce,reference issue:[34398](https://github.com/pingcap/tidb/issues/34398)
Senarios:
3,000 tables 80,000 parition, SQL:
```
SELECT table_name, engine, version, row_format, table_rows
, avg_row_length, data_length, max_data_length, index_length, data_free
, auto_increment, create_time, update_time, check_time, table_collation
, create_options, table_comment
FROM information_schema.tables
WHERE lower(table_schema) = ?
ORDER BY table_name
```
CPU profile:
image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.