Does TiDB support querying massive tree-structured data?

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

Original topic: TIDB 支持海量树型结构数据查询吗?

| username: TiDBer_lVKhiLUB

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version] 6.1
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Issue Phenomenon and Impact] Given the file path name, does TiDB have an optimization method for tree queries?
[Resource Configuration]
[Attachments: Screenshots / Logs / Monitoring]

| username: 近墨者zyl | Original post link

The built-in functions on the official website are not available.

| username: TiDBer_lVKhiLUB | Original post link

How is the performance of using CTE for recursive tree data in TiDB?

| username: hooopo | Original post link

Tree structure?

| username: TiDBer_lVKhiLUB | Original post link

Yes, query the child node information based on the parent node ID and the child node directory name.

| username: buddyyuan | Original post link

Are there any issues with using standard CTE for recursive queries now? Can you share the execution plan?

| username: hooopo | Original post link

Materialized Path will be faster, CTE is simple, but the performance won’t be very good.