Skip to content

Optimize the way optimizer do the index selection when topn is pushed down #64890

@winoros

Description

@winoros

Enhancement

In current physical optimization, pushing TopN down to the tikv is an individual part from the index selection. And the index selection happens before the topn's pushdown.

We find a case where: when the final plan is the case that topn pushed down, the cost we use to do the index selection is the one without topn's push down.
That is to say, we compare the different indexes' cost without the pushed topn, though it can be pushed down.
For IndexLookUp(TopN->IndexScan, TableScan) and TableReader(TopN->TableScan), we do the index selection between IndexLookUp(IndexScan, TableScan) and TableScan(TableScan), actually. This may lead to the wrong index selection because the network cost may have a large difference.

We may need to find a way to optimize it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    sig/plannerSIG: Plannertype/enhancementThe issue or PR belongs to an enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions