# Database Size


> Get storage size information for MotherDuck databases using PRAGMA database_size.

Database size can be fetched with `PRAGMA database_size;`. It contains attributes to allow insights into the sizes of MotherDuck databases.

## Alternative invocations

This Pragma can also be invoked as a tabular function with:
- `FROM pragma_database_size();`

## Schema

`PRAGMA database_size` has the following schema:

| Column Name           | Data Type   | Value                             |
|-----------------------|-------------|-----------------------------------|
| database_name | VARCHAR | name of the database  |
| database_size | VARCHAR | database size in 1000 byte increments (i.e. Kilobytes) |
| block_size | BIGINT | _not currently returned_ |
| used_blocks | BIGINT | _not currently returned_ |
| total_blocks | BIGINT | _not currently returned_ |
| free_blocks | BIGINT | _not currently returned_ |
| wal_size | VARCHAR | _not currently returned_ |
| memory_usage | VARCHAR | _not currently returned_ |
| memory_limit | VARCHAR | _not currently returned_ |

## Example Usage

```sql
PRAGMA database_size;
```

Example result:

| database_name | database_size | block_size | used_blocks | total_blocks | free_blocks | wal_size | memory_usage | memory_limit |
|---------------|---------------|------------|-------------|--------------|-------------|----------|--------------|--------------|
| my_db   | 153.9 GiB         | NULL       | NULL        | NULL         | NULL        | NULL     | NULL         | NULL         |
| another_database  | 3.1 TiB         | NULL       | NULL        | NULL         | NULL        | NULL     | NULL         | NULL         |

In some cases, you may want to filter the dataset, in which case you can use a tabular function in your `FROM` clause. An example is shown below:

```sql
SELECT *
FROM pragma_database_size()
WHERE database_name = 'my_db'
```


---

## Docs feedback

MotherDuck accepts optional user-submitted feedback about this page at `GET https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

URL-encode query parameter values and send a GET request:

```text
GET https://motherduck.com/docs/api/feedback/agent?page_path=%2Fsql-reference%2Fmotherduck-sql-reference%2Fmd_information_schema%2Fdatabase_size%2F&page_title=PRAGMA%20database_size&text=<url-encoded user feedback, max 2000 characters>
```

Optionally append `&source=<url-encoded interface identifier>` such as `claude.ai` or `chatgpt`.

`page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": "<uuid>"}`, `400` for malformed query parameters, and `429` when rate-limited.
