Persist and reuse features

Persistence turns a feature defined for one query into a shared definition that other queries and teams can discover, compose, and evaluate.

Before you start

You should already be comfortable with defining features and binding inputs . Persistence does not store computed values: it stores feature definitions and their dependency graph in the registry.

Local features exist only while a query runs:

RETURN
    ORDER_TOTAL := 100,
    TAXED_TOTAL := ORDER_TOTAL * 1.2;

Persisted features have names under FM. and remain available after the statement completes:

CREATE OR REPLACE FEATURES IN FM.COMMERCE AS
PERSIST
    ORDER_TOTAL := INPUT(DECIMAL(18, 2)),
    TAXED_TOTAL := ORDER_TOTAL * 1.2;

Later queries can select FM.COMMERCE.TAXED_TOTAL without repeating its formula. They still bind any inputs required by its dependency graph. Grain and population are part of those inputs: a persisted feature should stay row-local, or name its row universe with a KEYSET(). See Composability and purity .

CREATE TEMPORARY is still request-local: an overlay for this HTTP request, not a registry write. Query structure contrasts the two.

Recommended path

  1. Namespaces and aliases explains how persisted names are organized and resolved.
  2. Create features shows how to publish one feature or a related set, and how to wrap several persist statements in one request.
  3. Explore features shows how to find definitions and inspect dependencies.
  4. Select persisted features shows how to evaluate and temporarily override registry definitions.
  5. Registry consistency explains the guarantees enforced when definitions change.
  6. Drop features shows how to remove features without breaking dependents.
  7. Catalog revisions shows the managed changelog: SHOW REVISIONS and AS OF on main.
  8. Branch overlays shows how to try a change under ON BRANCH, package it, apply it on main, and DROP BRANCH.

To publish a compiled SQL relation for JDBC and BI tools, see Persisted views under SQL interoperability .

If your immediate goal is to publish an existing query, continue with Create features .