[Optimization] Pagination Query Logic Optimization, Support for tidb_enable_paging Hint Level

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

Original topic: 【优化】 分页查询逻辑优化,支持tidb_enable_paging hint级别

| username: Atlan

Feedback on Requirements
For detailed scenarios, please refer to this discussion (sql语句条件查询 效率低 - #16,来自 Atlan - TiDB 的问答社区). In certain pagination scenarios, enabling the paging option can significantly speed up query performance. However, currently, paging is only supported at the session level and the golabel database level, which is relatively difficult to handle in code (independent data connections or adjusting paging before and after statements). It is hoped that paging support can be added to hints.

| username: h5n1 | Original post link

In fact, many should be configured as HINT or statement parameters, such as blacklist, parallelism, etc.

| username: Roger_Song | Original post link

TiDB is planning to add a hint that allows setting any session variable at the SQL level.