Skip to content

sql: make prepared insert batches use bulk inserts #99319

@cucaroach

Description

@cucaroach

Make prepared batches process inserts in batches instead of row by row (ie when we see prepare/bind/exec on pgwire, treat “exec” to mean “batch” and only exec when batch gets big enough or we see a SYNC). I think this will work. Requires maintaining fail or success on a per row basis, JDBC prepared batch API supports this, its all run as one transaction but some rows can succeed and some can fail. In theory this should be the fastest insert path, no CSV parsing like in COPY and no ParseAndRequire overhead since values are strongly typed on the wire.

The idea is to follow the vectorized COPY lead and build up a coldata.Batch of each row and then throw those at the insert distsql processor.

Jira issue: CRDB-25814

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-queriesSQL Queries Team

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions