> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# Materialized view OpenLineage

> Export a materialized view's declared computation and column lineage without executing a refresh.

Export an existing asynchronous materialized view (MV) by name:

```sql theme={null}
EXPLAIN OPENLINEAGE [BRIEF | VERBOSE | FULL] [<db>.]<mv>;
```

Both shared-nothing and shared-data MV table kinds are supported. Synchronous rollup indexes are not separate named Dataset roots. This command analyzes the saved definition and does not refresh the MV or change refresh state.

Default BRIEF expands the root MV and stops at its direct sources. VERBOSE additionally expands one layer of direct View/MV/SV sources. FULL recursively follows definitions to physical tables, retaining all intermediate datasets and computation Jobs. See [logical view OpenLineage](/documents/4.2/using_starrocks/logical_view_openlineage.md) for the same expansion boundaries.

Assume `orders(id, amount)` exists:

```sql theme={null}
CREATE MATERIALIZED VIEW order_totals ORDER BY(id)
DISTRIBUTED BY HASH(id) BUCKETS 1 REFRESH DEFERRED MANUAL
PROPERTIES ('replication_num'='1')
AS SELECT SUM(amount) AS total, id FROM orders GROUP BY id;
EXPLAIN OPENLINEAGE FULL order_totals;
```

Each result row is a standard OpenLineage DatasetEvent or JobEvent. The MV Dataset has `datasetType=TABLE` and `subType=MATERIALIZED_VIEW`. Its definition Job carries SQL, inputs, outputs and lineage. No refresh Run is fabricated: a computation declaration is not evidence that a refresh executed.

`lineage.fields.total` derives from `orders.amount` with an AGGREGATION transformation; `id` derives from `orders.id`. GROUP\_BY is retained as an indirect control. Column pairing follows the saved SELECT-output mapping, **not physical storage/sort-key order**. In this example SELECT outputs `total, id` while storage orders `id, total`; neither the root MV nor a [semantic view](/documents/4.2/using_starrocks/semantic_view_openlineage.md) over it may swap those edges. Storage-only invisible columns are not invented as user query outputs.

SELECT on the MV is required, as is SELECT on each exposed source. Permission failures, missing definitions, schema/definition mismatches and cycles fail explicitly. This is declared design lineage, not refresh history, partition/run-level provenance, or a claim about the freshness of materialized rows.

```bash theme={null}
mysql -h 127.0.0.1 -P 9030 -u root --batch --skip-column-names --raw \
  -e 'EXPLAIN OPENLINEAGE FULL example_db.order_totals' > order-totals.ndjson
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.