> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-vortex-format.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> The Memory database engine keeps database metadata and tables only for the current server session.

# Memory

The `Memory` database engine keeps its metadata and table definitions only in memory. It is intended for temporary databases: the database and its tables are lost when the server stops or restarts.

<h2 id="creating-a-database">
  Creating a database
</h2>

```sql theme={null}
CREATE DATABASE temporary_data
ENGINE = Memory;
```

<h2 id="usage">
  Usage
</h2>

Create and use tables as in an [`Atomic`](/reference/engines/database-engines/atomic) database:

```sql theme={null}
CREATE TABLE temporary_data.events
(
    id UInt64,
    name String
)
ENGINE = Memory;

INSERT INTO temporary_data.events VALUES (1, 'started');
```

Do not use this engine for data or definitions that must survive a restart. Use `Atomic`, the default open-source database engine, for persistent database metadata.

<h2 id="see-also">
  See also
</h2>

* [Atomic database engine](/reference/engines/database-engines/atomic)
* [`Memory` table engine](/reference/engines/table-engines/special/memory)
