# ALTER NAMESPACE

The ALTER statement can be used to change authentication access and behaviour, global parameters, table configurations, table events, schema definitions, and indexes.

_(since v3.0.0)_

The `ALTER NAMESPACE` statement can be used to modify the namespace. `ALTER NAMESPACE` is used on the current namespace, which is why a `IF EXISTS` clause does not exist.

## Statement syntax

**SurrealQL Syntax**

```syntax title="SurrealQL Syntax"
ALTER NAMESPACE COMPACT
```

## COMPACT

Performs storage compaction onPerforms storage compaction on the current namespace keyspace. To compact other resources, use [ALTER SYSTEM](/docs/reference/query-language/statements/alter/system.md) to compact the entire datastore, [ALTER DATABASE](/docs/reference/query-language/statements/alter/database.md) to compact the current database keyspace, or [ALTER TABLE](/docs/reference/query-language/statements/alter/table.md) to compact a specific table keyspace.

The actual compaction used will depend on the datastore, such as RocksDB or SurrealKV.

This clause will not work with in-memory storage which has nothing persistent to compact, producing the following error:

```surql
'The storage layer does not support compaction requests.'
```

A successful compaction will return `NONE`.

```surql
ALTER NAMESPACE COMPACT;
-- NONE
```

## See also

* [`DEFINE NAMESPACE`](/docs/reference/query-language/statements/define/namespace.md)
