prorm API Reference
    Preparing search index...

    Interface MaterializedViewOptions

    Options for creating a materialized view

    interface MaterializedViewOptions {
        name: string;
        query: string;
        schema?: string;
        ifNotExists?: boolean;
        replace?: boolean;
        withData?: boolean;
        uniqueIndex?: string;
        comment?: string;
        build?: BuildMode;
        refresh?: RefreshMethod;
        on?: RefreshOn;
        refreshMode?: "IMMEDIATE" | "DEFERRED";
    }
    Index
    name: string

    Name of the materialized view

    query: string

    The SELECT query that defines the materialized view

    schema?: string

    Schema to create the materialized view in (PostgreSQL)

    ifNotExists?: boolean

    If true, uses CREATE MATERIALIZED VIEW IF NOT EXISTS

    replace?: boolean

    If true, uses CREATE OR REPLACE MATERIALIZED VIEW

    withData?: boolean

    Columns to include in the WITH DATA clause (for initial data load)

    uniqueIndex?: string

    Unique index name for CONCURRENTLY refresh support

    comment?: string

    Optional comment for the materialized view

    build?: BuildMode

    Build mode: IMMEDIATE or DEFERRED (Oracle)

    refresh?: RefreshMethod

    Refresh method: FAST, COMPLETE, or FORCE (Oracle)

    Refresh timing: COMMIT or DEMAND (Oracle)

    refreshMode?: "IMMEDIATE" | "DEFERRED"

    Ongoing maintenance mode: 'IMMEDIATE' keeps the materialized view in sync automatically on every write to a base table; 'DEFERRED' only updates it when explicitly refreshed (Db2: REFRESH IMMEDIATE|DEFERRED). This is independent of withData, which only controls whether the view is populated at creation time. Defaults to 'DEFERRED' to avoid the perf cost of continuous auto-maintenance unless explicitly requested.