pingcap / pingcap/tidb

planner: consider partition pruning when estimating partition table row counts

Open
#36,977 0 comments 0 reactions 1 assignee Claimed by @hawkingrei View on GitHub
component/statistics component/tablepartition epic/cardinality-estimation sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement
As you can see below, since the estimator doesn't consider partition pruning, the below two `IndexRangeScans` have the same `estRows`, but actually, they vary a lot:
![origin_img_v2_17f142e2-bcf9-42e4-b908-9198aa65b76g](https://user-images.githubusercontent.com/7499936/183549303-a06fd0ab-eb0a-40ed-82bc-751adb8e133f.jpg)

We can optimize it by using corresponding partition stats only to estimate or multiplying the result by `partitionRows / totalRows`.

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.