Skip to content

sql: when RETURNING expression is present, only fetch the specific columns used #30618

@nvb

Description

@nvb

See the following TODO:

cockroach/pkg/sql/update.go

Lines 191 to 192 in b2bd8e8

// TODO(dan): This could be made tighter, just the rows needed for RETURNING
// exprs.

We currently fetch all columns when an INSERT, UPDATE, or DELETE statement contains a RETURNING <exprs> clause. This is an issue because it forces us to retreive unnecessary data and it can create exrta contention. We should determine which columns the RETURNING expression needs and only request those exact columns.

This should be solved in conjunction with #18168 for maximum benefit.

Metadata

Metadata

Assignees

Labels

A-sql-mutationsMutation statements: UPDATE/INSERT/UPSERT/DELETE.A-sql-optimizerSQL logical planning and optimizations.C-performancePerf of queries or internals. Solution not expected to change functional behavior.E-starterMight be suitable for a starter project for new employees or team members.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions