---
title: OpenSharing materialization history system table reference
description: Learn how to analyze shared materialized data history using system tables.
canonical_url: https://docs.databricks.com/gcp/en/admin/system-tables/materialization
---

# OpenSharing materialization history system table reference

> [!NOTE]
> **Preview**
>
> This system table is in [Public Preview](https://docs.databricks.com/gcp/en/release-notes/release-types.md).

The shared materialized data history table represents data materializations created from view sharing, materialized views, and streaming tables using OpenSharing. It contains information on where the data came from, the securable being materialized, and when the materialization was created.

For more information about shared materializations, see [Add views to a share](https://docs.databricks.com/gcp/en/opensharing/create-share.md#views) and [Read shared views](https://docs.databricks.com/gcp/en/opensharing/read-data-databricks.md#views).

**Table path**: This system table is located at `system.sharing.materialization_history`.

## Record availability

Records are typically available within one hour. Data delivery for new workspaces can take longer than this.

## <a id="enable" />Enable the `materialization_history` schema

An account admin must enable the `materialization_history` schema:

1. In the account console, click **Previews** on the left side panel.
2. Enable **Sharing Materialization History System Table**.

## Shared materialized data history system table schema

The shared materialized data history system table uses the following schema:

| Column Name                  | Type      | Description                                                             | Example Data                                         | Nullable |
| :--------------------------- | :-------- | :---------------------------------------------------------------------- | :--------------------------------------------------- | :------- |
| `sharing_materialization_id` | string    | The unique ID of a data materialization.                                | `da38803f-2a62-4e27-bdb9-29b801c6dd84 `              | False    |
| `account_id`                 | string    | The ID of the Databricks account where the materialization was created. |                                                      | False    |
| `workspace_id`               | string    | The ID of the Databricks workspace billed.                              | `6051921418418893`                                   | False    |
| `recipient_name`             | string    | Name of the recipient using the data materialization.                   | `e2-dogfood`                                         | True     |
| `provider_name`              | string    | Name of the provider using the data materialization.                    | `aws:us-west-2:19a85dee-54bc-43a2-87ab-023d0ec16013` | True     |
| `share_name`                 | string    | Name of the share used to create data materialization.                  | `my_share`                                           | False    |
| `schema_name`                | string    | Name of the schema of the shared asset.                                 | `my_schema`                                          | False    |
| `table_name`                 | string    | Name of the table used to create data materialization.                  | `stocks`                                             | False    |
| `created_at`                 | timestamp | Timestamp of when the materialization was created.                      | `2025-01-01 00:00:00`                                | False    |

## Sample queries

This section includes the following sample queries you can use to gain insight into billing attribution:

* [An OpenSharing recipient asks how many DBUs were spent querying shared views](https://docs.databricks.com/gcp/en/admin/system-tables/materialization.md#recipient-views)
* [An OpenSharing recipient asks which provider queried the most usage](https://docs.databricks.com/gcp/en/admin/system-tables/materialization.md#recipient-usage)
* [An OpenSharing provider asks how many DBUs were spent on filtering views for open recipients](https://docs.databricks.com/gcp/en/admin/system-tables/materialization.md#provider-dbu)
* [An OpenSharing provider asks which open recipient is incurring the most cost](https://docs.databricks.com/gcp/en/admin/system-tables/materialization.md#provider-cost)

When the provider is billed for data materialization, only the provider can see query results. When the recipient is billed for data materialization, only the recipient can see query results.

For more details on how OpenSharing attributes and incurs costs, see [How do I incur and check OpenSharing costs?](https://docs.databricks.com/gcp/en/opensharing/index.md#share-costs).

### <a id="recipient-views" />An OpenSharing recipient asks how many DBUs were spent querying shared views

Replace instances of `...` with your information.

```sql
SELECT
  SUM(bu.usage_quantity)
FROM
  system.billing.usage bu
INNER JOIN
  system.sharing.materialization_history dm
ON
  dm.sharing_materialization_id = bu.usage_metadata.sharing_materialization_id
WHERE
  bu.billing_origin_product = 'DATA_SHARING' AND
 dm.share_name = '...' AND
 dm.schema_name = '...' AND
 dm.table_name IN (...);
```

### <a id="recipient-usage" />An OpenSharing recipient asks which provider queried the most usage

```sql
SELECT
  SUM(bu.usage_quantity) AS total_usage,
  dm.provider_name
FROM
  system.billing.usage bu
INNER JOIN
  system.sharing.materialization_history dm
ON
  dm.sharing_materialization_id = bu.usage_metadata.sharing_materialization_id
WHERE
  bu.billing_origin_product = 'DATA_SHARING'
GROUP BY
  dm.provider_name
ORDER BY
  total_usage DESC;
```

### <a id="provider-dbu" />An OpenSharing provider asks how many DBUs were spent on filtering views for open recipients

```sql
SELECT
  SUM(bu.usage_quantity)
FROM
  system.billing.usage bu
INNER JOIN
  system.sharing.materialization_history dm
ON
  dm.sharing_materialization_id = bu.usage_metadata.sharing_materialization_id
INNER JOIN
  system.information_schema.table_share_usage tsu
ON
  dm.share_name = tsu.share_name AND
  dm.schema_name = tsu.schema_name AND
  dm.table_name = tsu.table_name
INNER JOIN
  system.information_schema.tables t
ON
  t.table_catalog = tsu.catalog_name AND
  t.table_schema = tsu.schema_name AND
  t.table_name = tsu.table_name
WHERE
  bu.billing_origin_product = 'DATA_SHARING' AND
  t.table_type = 'VIEW';
```

### <a id="provider-cost" />An OpenSharing provider asks which open recipient is incurring the most cost

```sql
SELECT
 SUM(usage_quantity) AS usage,
 srp.recipient_name
FROM
  system.billing.usage bu
INNER JOIN
  system.sharing.materialization_history dm
ON
  dm.sharing_materialization_id = bu.usage_metadata.sharing_materialization_id
INNER JOIN system.information_schema.share_recipient_privileges srp
ON
  srp.share_name = dm.share_name
WHERE
  bu.billing_origin_product = 'DATA_SHARING'
GROUP BY
  srp.recipient_name
ORDER BY
  usage DESC
LIMIT 1;
```
