pingcap / pingcap/tidb

"show stats_xxx" is slow if there are massive tables

Open
#64,621 1 comment 0 reactions 0 assignees 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

This is a SaaS user with more than 190,000 tables. `show stats_xxx` is too slow in this scenario. See the example below, `show stats_buckets where db_name=? and table_name=? and column_name=?` takes around 2mins to return the result:

Image

Contributor guide

Open the contributing guide

Research direction

Start by locating the implementation of the `show stats_buckets` command and reproduce the reported query with a database containing more than 190,000 tables. Trace why filtering by `db_name`, `table_name`, and `column_name` takes about two minutes; done means the command returns substantially faster for this scenario, with regression coverage where the relevant tests are found.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.