Skip to content

PgCustomScanPlanner

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Describes a plain table the planner is about to scan and collects the custom scan paths offered for it.

public readonly ref struct PgCustomScanPlanner

The planner is valid only during Plan(PgCustomScanPlanner). Ankus offers ordinary tables and materialized views, including inheritance children and partitions. It does not offer tables whose rows the query locks or modifies, or whose system columns it reads, because a custom scan’s rows have no physical location.

Offers a path that PostgreSQL’s parallel workers and the leader run together, each producing part of the rows.

public void AddParallelPath(PgCustomScanPath path, int workers)

Parameters:

path — PgCustomScanPath

The whole scan’s costs and optional row estimate, with its data and sort keys. Ankus divides the run cost and the rows among the processes, as PostgreSQL does for a parallel sequential scan.

workers — int

The workers the path plans for, at most PostgreSQL’s max_parallel_workers_per_gather.

Exceptions:

PostgreSQL considers the path only for a table and query that can run in parallel, and not for a scan whose conditions depend on an outer row. The processes divide the rows through the provider’s shared memory; see IPgParallelCustomScan<TState, TShared>.

Offers a path. The planner keeps it only if no other path is cheaper for every purpose.

public void AddPath(PgCustomScanPath path)

Parameters:

path — PgCustomScanPath

The path’s costs, optional row estimate, data and sort keys.

Exceptions:

  • ArgumentOutOfRangeException: A cost or row estimate is negative or not finite, the total cost is below the startup cost, or a sort key is not a column of the table.
  • ArgumentException: A sort key names a dropped column.

Gets whether the query reads a column from this table’s rows, for its output or its conditions.

public bool IsColumnRead(int ordinal)

Parameters:

ordinal — int

The column’s zero-based position in Descriptor.

Returns: bool

Whether the column is read, so that a path’s cost can include only the columns it must produce.

Exceptions:

Gets the lowest startup cost among the table’s existing paths, or positive infinity when it has none.

public double CheapestStartupCost { get; }

Value: double

Gets the lowest total cost among the table’s existing paths, or positive infinity when it has none.

public double CheapestTotalCost { get; }

Value: double

Gets the table’s columns, including dropped columns, in the order rows hold them.

public PgTupleDescriptor Descriptor { get; }

Value: PgTupleDescriptor

The descriptor is loaded from the catalog on first use, so a provider that ignores a table does not pay for it.

Gets the table’s name.

public string RelationName { get; }

Value: string

Gets the table’s OID.

public uint RelationOid { get; }

Value: uint

Gets the planner’s estimate of the rows left after the query’s conditions on this table.

public double Rows { get; }

Value: double

Gets the table’s schema name.

public string SchemaName { get; }

Value: string