# Schema and maintenance procedures

[Wiki](../README.md) / [Cypher query language](README.md)

**On this page**

- [Schema / token procedures](#schema--token-procedures)
- [String-interner maintenance](#string-interner-maintenance)
- [Schema visualization](#schema-visualization)

A `CALL` of a procedure the database does not have fails with
`Galactus.ClientError.Procedure.ProcedureNotFound` (from version 2.1.3). A
`gds.` name that should be `gdb.`, such as `gds.compact()`, gets a hint naming
the right procedure.

## Schema / token procedures

| Procedure | YIELD | Description |
|---|---|---|
| `db.labels()` | `label` | All known node labels |
| `db.relationshipTypes()` | `relationshipType` | All known relationship types |
| `db.propertyKeys()` | `propertyKey` | All known property keys |
| `db.indexes()` | `name, type, entityType, labelsOrTypes, properties` | Legacy Browser catalogue: single-property hash (reported as `RANGE`), full-text, vector and point declarations; use `SHOW INDEXES` plus specialised SHOW statements for complete coverage |
| `db.constraints()` | `name, description` | Single-property uniqueness constraints; use `SHOW CONSTRAINTS` for every constraint kind |
| `db.awaitIndexes([timeout])` | *(void)* | No-op that yields nothing. GDB builds indexes synchronously, so they are online the moment `CREATE INDEX`/`CREATE CONSTRAINT` returns — there is never anything to await. Exists so an `apoc.export.cypher.all` script (which emits `CALL db.awaitIndexes(300)` after its schema block) restores unchanged. |
| `db.awaitIndex(name[, timeout])` | *(void)* | Single-index variant of the above; likewise a no-op. |

```cypher
CALL db.indexes() YIELD name, type, labelsOrTypes, properties
RETURN name, type, labelsOrTypes, properties;

CALL db.propertyKeys() YIELD propertyKey RETURN propertyKey ORDER BY propertyKey;
```

> Note: GDB lists known *tokens*; a label/type/key token persists after the last
> element carrying it is deleted. These lists do not indicate whether a token is currently in use.

## String-interner maintenance

| Procedure | Description |
|---|---|
| `gdb.compactStrings()` | Vacuum: free interned property-string values no record references any more. Returns how many were reclaimed. |
| `gdb.stringStats()` | Report how many distinct property strings are currently interned. |

```cypher
CALL gdb.compactStrings();
CALL gdb.stringStats();
```

Interning is on by default and already reclaims eagerly on overwrite/delete and at
checkpoint; these procedures are an on-demand vacuum / introspection. See
[Operations](../operations/README.md).

## Schema visualization

```cypher
CALL db.schema.visualization() YIELD nodes, relationships
RETURN nodes, relationships;
```

This returns a virtual schema graph for Browser and Explorer, rather than the
database's data nodes. See [database administration](../operations/databases.md)
for `dbms.*`, [backups](../operations/backups.md) for standalone maintenance calls,
and the [procedure directory](../reference/procedures.md) for other namespaces.

## Related articles

[Indexes and constraints](../indexes/README.md) · [Procedure directory](../reference/procedures.md) · [Transactions and concurrency](../operations/transactions.md)
