Support for SPATIAL functions, data types and indexes

I am interested in adding this feature to tidb 。
Now I implemented features:

  • Data type named GEOMETRY for representing spatial values
  • Some functions for manipulating spatial values ,such as MBR* ,ST_GeomFromText,ST_AsWkb ,ST_Evenlope, …

When I want implement the feature spatial index ,I have some problems
TiKV is a complex system, Which module is related to index and where do I break through

1 Like

Hello @usretyn,

Welcome to TiDB community and thanks for the contribution!

TiKV is a complex system, Which module is related to index and where do I break through

It’s a bit complicated when you talk about ‘index in TiKV’, it’s better to talk about more details of ‘index manipulation’ you would like to dive into, but before that:

  • For the insert/update of the index, the encoding is done at TiDB side, TiKV receives the insert/update operations, applies them.
  • For the read of the index, it is done in some executors, for example: BatchIndexScanExecutor

Anyway, feel free to ask more questions here :slight_smile:

And some more suggestions:

  1. Feel free to assign yourself to this issue: https://github.com/pingcap/tidb/issues/6347 and leave a short description about your idea: goals(GEOMETRY type, functions, index…) and non-goals.

  2. Propose a pull request for the draft of your design(RFC): https://github.com/pingcap/tidb/tree/master/docs/design, you could refer to some PRs like #33026 and #31260. It doesn’t have to be complete and perfect at the first time, the purpose of this is to synchronize your idea with the others so that we could have further discussion based on it.

thank you !

spsatial index using rtree i , rtree index is different btree . how can I save the spatial index to rocksdb ?

Where is the code encoding index in Tidb? where is the code save index operations in TiKV?