Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support stale read through SQL hints #59938

Open
cfzjywxk opened this issue Mar 6, 2025 · 0 comments
Open

Support stale read through SQL hints #59938

cfzjywxk opened this issue Mar 6, 2025 · 0 comments
Labels
type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@cfzjywxk
Copy link
Contributor

cfzjywxk commented Mar 6, 2025

Feature Request

Is your feature request related to a problem? Please describe:

Stale read could be enabled by tidb_read_staleness, but it has some inconveniences, including:

  • Using stale read tidb_read_staleness through session-level settings is very complicated, and the users may need to ensure that the session variable is set back after each use of stale read
  • It also does not accept adding AS OF TIMESTAMP syntax to SQL to use stale read, which will cause the code to violate common coding rules and be bound to a certain feature of TiDB.

Describe the feature you'd like:

Introduce a new HINT to specify the tidb_read_staleness, makes TiDB specify the staleness in the statement, like

SELECT /*+ READ_STALENESS(-5) */ * FROM table1 WHERE ...

Or together with SetVar,
to support enabling query level stale read.

Describe alternatives you've considered:

As mentioned above for the usages of tidb_read_staleness and AS OF TIMESTAMP.

Teachability, Documentation, Adoption, Migration Strategy:

@cfzjywxk cfzjywxk added the type/feature-request Categorizes issue or PR as related to a new feature. label Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

1 participant