Skip to main content

worker_ctid_range

Function worker_ctid_range 

Source
fn worker_ctid_range(
    config: &RawSourceCreationConfig,
    estimated_blocks: u64,
    oid: u32,
) -> Option<CtidRange>
Expand description

Calculate the ctid range for a given worker based on estimated block count.

The table is partitioned by block number across all workers. Each worker gets a contiguous range of blocks. The last worker gets an open-ended range to handle any rows beyond the estimated block count.

When estimated_blocks is 0 (either because statistics are unavailable, the table appears empty, or PostgreSQL version < 14 doesn’t support ctid range scans), the table is assigned to a single worker determined by config.responsible_for(oid) and that worker scans the full table.

Returns None if this worker has no work to do.