pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
37.04k stars 5.82k forks source link

support `explain analyze format = zip` to collect metrics to investigate slow query #20419

Open zz-jason opened 3 years ago

zz-jason commented 3 years ago

Feature Request

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

To investigate a slow query, typically we need the following information:

Collecting these metrics is not easy, it involves lots of discussion with users and explanations. If we could collect all the needed information, it would greatly save the time to collect useful information and reduce the time to find the slow reason.

Describe the feature you'd like:

explain analyze format = zip ... statement to collect all the needed information, putting them to a zip file, then users can provide us the zip file to help investigate the root cause.

Describe alternatives you've considered:

N/A

Teachability, Documentation, Adoption, Migration Strategy:

N/A

ghost commented 3 years ago

For slow query, maybe it is better to include the information from information_schema.statements_summary? I would also add bind_info to the list of sources.

zz-jason commented 3 years ago

both information_schema.statements_summary and bind_info is helpful for investigation.

zz-jason commented 3 years ago

@breeswish It would be better if we can support collecting these metrics in TiDB Dashboard.

breezewish commented 3 years ago

The idea is great. Tracing & metrics can be supplied as well. I only concern about the implementation for some parts. For example:

As a reference, CockroachDB may have something similar: https://www.cockroachlabs.com/docs/stable/admin-ui-statements-page.html#diagnostics