---
title: "DEALLOCATE"
url: "https://docs.yugabyte.com/stable/api/ysql/the-sql-language/statements/perf_deallocate/"
---

# DEALLOCATE

Use the `DEALLOCATE` statement to deallocate a previously prepared SQL statement.

## Synopsis

Use the `DEALLOCATE` statement to deallocate a previously prepared SQL statement.

## Syntax

- [![Grammar Icon](/icons/file-lines.svg)Grammar](#grammar-1)
- [![Diagram Icon](/icons/diagram.svg)Diagram](#diagram-1)

```output.ebnf
deallocate ::= DEALLOCATE [ PREPARE ] { name | ALL }
```

#### deallocate

DEALLOCATEPREPARE[name](/stable/api/ysql/syntax_resources/grammar_diagrams#name)ALL

## Semantics

### *name*

Specify the name of the prepared statement to deallocate.

### ALL

Deallocate all prepared statements.

## Examples

Prepare and deallocate an insert statement.

```plpgsql
yugabyte=# CREATE TABLE sample(k1 int, k2 int, v1 int, v2 text, PRIMARY KEY (k1, k2));
```

```plpgsql
yugabyte=# PREPARE ins (bigint, double precision, int, text) AS
               INSERT INTO sample(k1, k2, v1, v2) VALUES ($1, $2, $3, $4);
```

```plpgsql
yugabyte=# DEALLOCATE ins;
```

## See also

- [EXECUTE](/stable/api/ysql/the-sql-language/statements/perf_execute "EXECUTE")
- [PREPARE](/stable/api/ysql/the-sql-language/statements/perf_prepare "PREPARE")
