---
sidebar_position: 1
title: STORAGE_INFO views
description: View storage footprint, billing, and lifecycle information for all databases in your MotherDuck organization
---

import Admonition from '@theme/Admonition';

# STORAGE_INFO views

:::note Admin Only Feature
This feature can only be used by Admin users.
:::

## Overview

MotherDuck provides two views to look at how much storage is used - a current snapshot (`STORAGE_INFO`) and the previous 30 days of history (`STORAGE_INFO_HISTORY`).

The `MD_INFORMATION_SCHEMA.STORAGE_INFO` view provides comprehensive storage information for all databases in your MotherDuck organization. This view is essential for understanding storage usage, billing calculations, and database lifecycle management.

The `MD_INFORMATION_SCHEMA.STORAGE_INFO_HISTORY` view provides storage information for up to the past 30 days of usage.

If you're an admin, you can view your organization's storage breakdown on the [databases page](https://app.motherduck.com/settings/databases). Here, you'll find the total breakdown of current bytes across all your databases, as well as a breakdown for each database. You can also click on a row to get a lifecycle breakdown for a given database.

## Syntax

To see the latest snapshot:

```sql
SELECT * FROM MD_INFORMATION_SCHEMA.STORAGE_INFO;
```

To see the history:

```sql
SELECT * FROM MD_INFORMATION_SCHEMA.STORAGE_INFO_HISTORY;
```

## Columns

The `MD_INFORMATION_SCHEMA.STORAGE_INFO` view returns one row for each database in your organization with the following columns:

| Column Name             | Data Type | Description                                                                                                                            |
| ----------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `database_name`         | VARCHAR   | Name of the database                                                                                                                   |
| `database_id`           | UUID      | Unique ID for the database                                                                                                             |
| `created_ts`            | TIMESTAMP | Time when the database was created                                                                                                     |
| `deleted_ts`            | TIMESTAMP | Time when the database was deleted (NULL if not deleted)                                                                               |
| `user_name`              | VARCHAR   | Username of the database owner                                                                                                         |
| `active_bytes`          | BIGINT    | Actively referenced bytes of the database                                                                                              |
| `historical_bytes`      | BIGINT    | Non-active bytes that are referenced by a share of this database                                                                       |
| `retained_for_clone_bytes` | BIGINT    | Bytes referenced by other databases (through zero-copy clone) that are no longer referenced by this database as active or historical bytes |
| `failsafe_bytes`        | BIGINT    | Bytes that are no longer referenced by any database or share                                                                           |
| `transient`             | BOOLEAN   | Whether the database is transient                                                                                                      |
| `historical_snapshot_retention` | INTERVAL | Period of time the database's snapshots are retained after becoming inactive                                                    |
| `computed_ts`           | TIMESTAMP | Time at which active_bytes, historical_bytes, etc. were computed                                                                       |

The `MD_INFORMATION_SCHEMA.STORAGE_INFO_HISTORY` view has the same schema, but will return results from up to the past 30 days, so a single database might have multiple entries reflecting its state at different points in time.

## Examples

### Basic usage

View storage information for all databases in your organization:

```sql
-- Get storage information for all databases
SELECT * FROM MD_INFORMATION_SCHEMA.STORAGE_INFO;
```

**Sample results:**

| database_name | database_id                          | created_ts          | deleted_ts | user_name | active_bytes | historical_bytes | retained_for_clone_bytes | failsafe_bytes | transient | historical_snapshot_retention | computed_ts             |
| ------------- | ------------------------------------ | ------------------- | ---------- | -------- | ------------ | ---------------- | --------------------- | -------------- | -------- | --------------------- | ---------------------- |
| test_db_1     | 7ed1baf3-e4ff-42c9-a37b-9f683905ce45 | 2024-12-02 20:18:36 | NULL       | bob      | 82063360     | 0                | 268496896             | 0              | false | 1 day | 2025-06-25 16:46:16.37 |
| test_db_2     | fcc16e53-d761-4e40-84ec-15570fab363e | 2024-11-12 03:38:52 | NULL       | jim      | 274432       | 0                | 0                     | 0              | false | 1 day | 2025-06-25 16:46:16.37 |

### Filtering and analysis

Find databases with high storage usage:

```sql
-- Find databases using more than 1GB of active storage
SELECT
    database_name,
    user_name,
    active_bytes,
    ROUND(active_bytes / 1000.0 / 1000.0 / 1000.0, 2) as active_gb
FROM MD_INFORMATION_SCHEMA.STORAGE_INFO
WHERE active_bytes > 1000000000  -- 1GB in bytes
ORDER BY active_bytes DESC;
```

### Storage cost analysis

Analyze storage costs by user:

```sql
-- Calculate total storage usage per user
SELECT
    user_name,
    COUNT(*) as database_count,
    SUM(active_bytes) as total_active_bytes,
    SUM(historical_bytes) as total_historical_bytes,
    SUM(retained_for_clone_bytes) as total_cloned_bytes,
    SUM(failsafe_bytes) as total_failsafe_bytes
FROM MD_INFORMATION_SCHEMA.STORAGE_INFO
GROUP BY user_name
ORDER BY total_active_bytes DESC;
```

Analyze active and failsafe storage footprint over the past week for a specific database:

```sql
SELECT active_bytes, failsafe_bytes, computed_ts
FROM MD_INFORMATION_SCHEMA.STORAGE_INFO_HISTORY
WHERE database_name = "my_database"
AND computed_ts >= NOW - INTERVAL 7 DAYS
ORDER BY computed_ts DESC;
```

## Notes

- **Data Refresh**: Information in this view refreshes every 1-6 hours
- **Retention**: STORAGE_INFO_HISTORY only returns one set of results per day, even though the latest results are re-computed multiple times per day
- **Billing Data**: This view returns the underlying data used to power MotherDuck storage billing
- **Permissions**: You must have appropriate permissions to access this view
- **Organization Scope**: Only shows databases within your current organization

### Understanding timestamps

The `created_ts` column in `STORAGE_INFO` represents when the **database** was created. This is useful for understanding database age and lifecycle.

For [point-in-time restore](/concepts/data-recovery) scenarios, use [`DATABASE_SNAPSHOTS`](/sql-reference/motherduck-sql-reference/md_information_schema/database_snapshots) instead, where `created_ts` represents when each **snapshot** was created.

| View | `created_ts` meaning | Use case |
|------|---------------------|----------|
| `STORAGE_INFO` | When the database was created | Storage billing, database lifecycle management |
| `DATABASE_SNAPSHOTS` | When the snapshot was created | Point-in-time restore, finding snapshots to recover |

## Troubleshooting

### Common issues

**Outdated information**

- Data refreshes only happen periodically, so recent changes may not be immediately visible

**Permission denied errors**

- Contact your organization administrator to ensure you have the necessary permissions
  - This feature is only for Admins
- Verify your authentication token is valid and has the required scope
