---
sidebar_position: 5
title: PRAGMA database_size
description: Get storage size information for MotherDuck databases using PRAGMA database_size.
---

# 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 `POST https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

Payload:

```json
{
  "page_path": "/sql-reference/motherduck-sql-reference/md_information_schema/database_size/",
  "page_title": "PRAGMA database_size",
  "text": "<the user's feedback, max 2000 characters>",
  "source": "<optional identifier for your interface, for example 'claude.ai' or 'chatgpt'>"
}
```

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