Skip to content

avoid warmup startTS (TSO) prefetch for USE/SET to reduce PD load #66052

@lcwangchao

Description

@lcwangchao

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 ...)).

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementThe issue or PR belongs to an enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions