Skip to content

planner: simplify visited table tracking in collect_column_stats_usage #67912

Closed

Description

@0xPoe

Enhancement

pkg/planner/core/rule/collect_column_stats_usage.go currently keeps both visitedPhysTblIDs and visitedtbls.

In collectPredicateColumnsForDataSource(), both are populated with the same table ID (ds.TableInfo.ID), while visitedPhysTblIDs is already collected unconditionally.

Proposal

  • reuse visitedPhysTblIDs for plan replayer table stats recording
  • remove the redundant visitedtbls field
  • clarify the visitedPhysTblIDs name/comment if needed, since the current code inserts table IDs rather than ds.PhysicalTableID

Benefit

Reduce duplicated state and make the collector easier to understand, with no intended behavior change.

Activity

  1. pinkbit256 commented on Apr 20, 2026

    @pinkbit256
    Contributor

    @0xPoe I'm working on this, thank you!

  2. added a commit that references this issue on May 11, 2026
    d65f4df
  3. added a commit that references this issue on Jun 3, 2026
    9c2b1bd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions