CockroachDbBulkImportPseudoTableType

An enumeration that is being used to define the type of staging (pseudo) table to be created during the bulk-import operations.

This enum defines the type of staging (pseudo) table created during bulk-import operations. It applies only to CockroachDB.

It is used by BulkInsert (only when identityBehavior is ReturnIdentity), BulkMerge, BulkUpdate, BulkDelete and BulkDeleteByKey.

Enum Values

Name Description
Auto Selects Physical when the entity/row count being bulk-written is 5,000 or more, otherwise selects Memory. This is the default.
Memory Backs the operation with a temporary table. Rows are session-private, isolating the execution from any concurrent executions on other connections.
Physical Backs the operation with an ordinary heap table. Rows are not session-isolated, so concurrent callers can see and interfere with each other’s staged rows, but it is faster and more efficient for large, sequential bulk operations.

Unlike the equivalent enum on some other providers, Auto’s row-count threshold is genuinely implemented here — it is not a fixed alias for either of the other two values.

Requesting Memory executes SET experimental_enable_temp_tables = 'on'; first — CockroachDB only supports temporary tables experimentally and otherwise rejects CREATE TEMP TABLE with a XCEXF error.

Usability

Pass the value to the pseudoTableType argument of the target operation.

using (var connection = new CockroachDbConnection(connectionString))
{
    var people = GetPeople(1000);
    var insertedRows = connection.BulkInsert(people,
        identityBehavior: CockroachDbBulkImportIdentityBehavior.ReturnIdentity,
        pseudoTableType: CockroachDbBulkImportPseudoTableType.Physical);
}