-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Open
Labels
type/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.
Description
Enhancement
TiDB currently may prepare an async startTS future (TSO prefetch) during compile/warmup stage, even for statements that usually don't touch KV, e.g. USE and simple SET.
For workloads with lots of such statements, this causes unnecessary PD TSO requests.
Warmup happens before executor runs (compile stage) and is intended as an optimization. For USE / simple SET, prefetching TSO brings little to no benefit but increases PD load/QPS.
We should skip preparing the startTS future in warmup for these statement types, while still guaranteeing correctness:
- If a statement later truly needs TSO, it must still be fetched when the txn is activated / execution requires it (e.g.
SET @a=(SELECT ...)).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.