pingcap/tidb

Support Dumping Table Statistics With A SQL Statement

Open

#18,635 建立於 2020年7月16日

在 GitHub 查看
 (9 留言) (0 反應) (0 負責人)Go (6,186 fork)batch import
feature/acceptedhelp wantedtype/feature-request

倉庫指標

Star
 (40,090 star)
PR 合併指標
 (平均合併 14天 4小時) (30 天內合併 346 個 PR)

描述

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.

貢獻者指南