Tidb_opt_seek_factor not working

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb_opt_seek_factor不起作用

| username: h5n1

v7.5.1

According to the official documentation:

If the statistics are accurate, why is reading from TiFlash faster, but the optimizer chooses TiKV?
Currently, the cost model distinguishing TiFlash and TiKV is still relatively rough. You can reduce the value of tidb_opt_seek_factor to make the optimizer prefer TiFlash.

Testing with the default value shows the execution plan cost as follows:

Increasing the parameter value does not change the cost:

Decreasing the parameter value does not change the cost, and the execution plan does not choose TiKV:

Additionally, there is a significant difference between estcost in format=‘cost_trace’ and format=verbose. How should the various tfilash_factor values in the costFormula be adjusted?

| username: h5n1 | Original post link

Testing cost_mode_version=1 yields the same result.

| username: 人如其名 | Original post link

Try adjusting this: tidb_opt_scan_factor.
The tidb_opt_seek_factor parameter seems to be the cost of searching a range. The data volume here looks relatively small, possibly just one range.