Call for help & discuss: support loose index scan for TiDB

We had this feature request for a long time, but it is not yet supported. Let’s discuss about it here and see how can we do it.

For what loose index scan is, please refer to https://wiki.postgresql.org/wiki/Loose_indexscan

1 Like

the goal of the discuss is to produce a design doc and an action plan for the development of this feature for tidb, and I’ll help drive it.

1 Like

I am interested in the TiKV side implementation.

In order to add Loose index scan support, maybe we need to add a new Executor other than point_get and scan.

I’m not familiar with SQL/TiDB side though…

Well why not use TiFlash?

Yeah, using TiFlash indeeds helps, but it is not solving the problem algorithmically…

Forgive my previous misunderstanding.

The tricky part can be when we should re-seek to next value, or just scan sequentially to next value, since re-seek can be costly. A simple heuristic is just continue the scan til the block boundary, then re-seek to next value.

This heuristic was used in my previous team at Alibaba to solve a very similar problem.

And this heuristic works well even without cardinality info.

I would consider the heuristic an optimization for loose index scan, thanks for letting us know about this~