Skip to content

perf: add KV read-modify-write primitive #29431

@petermattis

Description

@petermattis

Forked from #18657 (comment). For operations such as INSERT INTO .... VALUES(...) ON CONFLICT DO UPDATE SET n = n+1 it would be useful to have a KV primitive that encapsulated the n = n + 1 operation into a single round trip.

Yes, it's possible to push the read-modify-write steps down into the KV layer so it can all be done in one round trip. We have a KV Increment command that serves as a proof of concept for this, although it's not hooked up for use from SQL. This would be the ideal solution for your ON CONFLICT DO UPDATE SET x=x+1 (as opposed to UPSERT which just does a blind write of specified values).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-kv-clientRelating to the KV client and the KV interface.A-sql-mutationsMutation statements: UPDATE/INSERT/UPSERT/DELETE.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)X-stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions