-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: batch SQL stats flush #67867
Copy link
Copy link
Closed
Labels
A-sql-observabilityRelated to observability of the SQL layerRelated to observability of the SQL layerC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Description
The initial implementation for SQL Stats flush logic performs as follow:
- It tries to run an
INSERT ... ON CONFLICT DO NOTHINGstatement for each stats object. - If it encounters an conflict, it reads the
statisticscolumn from the conflicting row and update it with new stats usingSELECT ... FOR UPDATEstatement - It runs a
UPDATEstatement 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-observabilityRelated to observability of the SQL layerRelated to observability of the SQL layerC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)