-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
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.