Skip to content

sql: batch SQL stats flush #67867

@Azhng

Description

@Azhng

The initial implementation for SQL Stats flush logic performs as follow:

  1. It tries to run an INSERT ... ON CONFLICT DO NOTHING statement for each stats object.
  2. If it encounters an conflict, it reads the statistics column from the conflicting row and update it with new stats using SELECT ... FOR UPDATE statement
  3. It runs a UPDATE statement to update the rows.

Note that for the fast path, we are performing 1 network round trip, and for slow path, we are performing 3 network round trip.

We can amortize this by batch multiple stats object into a single requests and improve the throughput.

Jira issue: CRDB-8749

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sql-observabilityRelated to observability of the SQL layerC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions