Bulk Operations
Set-based inserts, updates, deletes, and merges that bypass row-by-row round trips entirely.
What it is
Bulk operations give you set-based BulkInsert, BulkUpdate, BulkDelete, and BulkMerge methods that push an entire collection to the server in one native bulk-copy call, instead of one round trip per row.
Supported providers
All providers ship native bulk-copy support through their respective RepoDB provider packages. SQLite falls back to a batched multi-row statement since it has no native bulk-copy protocol.
Provider bulk operations pages
Each provider’s bulk mechanism differs in its specifics — the staging-table strategy, the native bulk-load API it rides on, and how identity values are returned. See the dedicated operations page for the provider you’re using.
| Page | Description |
|---|---|
| AuroraDB MySqlConnector | AuroraDbBulkCopy, a LOAD DATA LOCAL INFILE-based bulk writer, for Amazon Aurora MySQL. |
| AuroraDB PostgreSQL | AuroraDbBulkCopy, a native binary COPY-based bulk writer, for Amazon Aurora PostgreSQL. |
| ClickHouse | An internal ClickHouseBulkCopy class adapting ClickHouse.Driver’s own native bulk insert. |
| CockroachDB | CockroachDbBulkCopy, a native binary COPY-based bulk writer. |
| Db2 | The DB2BulkCopy class of the IBM Data Server .NET Provider (IBM.Data.Db2). |
| DuckDB | The native DuckDBAppender class of DuckDB.NET. |
| EnterpriseDB | Bulk methods against EDBConnection, alongside RepoDB’s standard operations. |
| Firebird | Bulk methods against FbConnection, alongside RepoDB’s standard operations. |
| MariaDB | A LOAD DATA LOCAL INFILE-based MariaDbBulkCopy class, via the MySql.Data-based driver. |
| MariaDbConnector | The MariaDB-flavored MariaDbBulkCopy class, via the MySqlConnector-based driver. |
| MySQL | A LOAD DATA LOCAL INFILE-based bulk writer, via the MySql.Data driver. |
| MySqlConnector | The MySqlBulkCopy class of the MySqlConnector namespace. |
| Oracle | The OracleBulkCopy class, which always performs a direct-path load. |
| PostgreSQL | Npgsql’s NpgsqlBinaryImporter, via a dedicated BinaryImport method. |
| SAP HANA | Bulk methods against HanaConnection, alongside RepoDB’s standard operations. |
| SQL Server | The ADO.NET SqlBulkCopy class of Microsoft.Data.SqlClient. |
| Vertica | Bulk methods against VerticaConnection, alongside RepoDB’s standard operations. |
Basic usage
var rows = GenerateOrders(50_000);
connection.BulkInsert(rows);
connection.BulkMerge(rows, qualifiers: e => e.ExternalId);
When to reach for it
Anything beyond a few hundred rows benefits from a bulk call. Below that, the fixed cost of preparing a bulk-copy operation can outweigh the savings, and a plain InsertAll is simpler.