Link Search Menu Expand Document

ClickHouseBulkImportPseudoTableType


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

It is used by the following bulk operations.

BulkInsert never uses a pseudo table — this enum has no effect on it. Rows are always written straight to the target table, since identityBehavior: ReturnIdentity (the only reason a pseudo table would be needed for an insert) is never supported for ClickHouse.

Enum Values

NameDescription
AutoChooses between Physical and Memory based on row count (Physical at 5,000 rows or more). This is the default.
MemoryA staging table backed by ClickHouse’s Memory table engine, private to the current session.
PhysicalA staging table backed by an ordinary MergeTree table (ORDER BY tuple()). Not session-isolated, but faster to create.

Every value currently resolves to Physical at runtime — the internal resolution method returns Physical on both branches of its row-count check, regardless of the value passed in or the actual row count. The Memory branch is fully implemented in the SQL builder but not yet reachable. Because a physical pseudo table has no per-session isolation, avoid running concurrent bulk operations against the same target table until this is resolved. See Operations (ClickHouse) for details.

Usability

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

using (var connection = new ClickHouseConnection(connectionString))
{
    var people = GetPeople(1000);
    var mergedRows = connection.BulkMerge(people,
        pseudoTableType: ClickHouseBulkImportPseudoTableType.Physical);
}