pingcap/tidb

Support Dumping Table Statistics With A SQL Statement

Open

#18,635 opened on 2020年7月16日

GitHub で見る
 (9 comments) (0 reactions) (0 assignees)Go (6,186 forks)batch import
feature/acceptedhelp wantedtype/feature-request

Repository metrics

Stars
 (40,090 stars)
PR merge metrics
 (平均マージ 14d 4h) (30d で 346 merged PRs)

説明

Feature Request

Is your feature request related to a problem? Please describe:

For now we can only dump statistics via HTTP API(Introduction to Statistics):

curl http://${tidb-server-ip}:${tidb-server-status-port}/stats/dump/${db_name}/${table_name} > ${table_name}.stats.json

The problem is:

  • There is no privilege check on HTTP API
  • For some use cases, it's not easy to use compared with SQL statements

Describe the feature you'd like:

Support a SQL statement do dump the statistics into a file.

Things need to consider:

  • How to dump stats to a file located on the client-side?
  • How does this SQL statement cooperate with the LOAD STATS command?

Describe alternatives you've considered:

N/A

Teachability, Documentation, Adoption, Migration Strategy:

  • This simplifies documentation since examples can be shown assuming the user has an existing connection to TiDB. i.e. the variables ${tidb-server-ip} and ${tidb-server-status-port} might be confusing. From where they are, there may also be a firewall restricting HTTP API access (but allowing mysql port)

  • This could optionally be integrated to dumpling as a flag to preserve stats. This would help in cases where support works with customers to help reproduce issues.

コントリビューターガイド