---
name: "purge"
section: "7l"
platform: "linux"
package: "postgres95"
version: "1.09-1"
release: "Debian 1.3 (Bo)"
platforms: ["linux"]
url: "https://new.carta.tech/purge/7l"
---

# purge(7l)

discard historical data

## NAME

purge — discard historical data

## SYNOPSIS

```
purge classname [ before abstime ] [ after reltime ]
```

## DESCRIPTION

**Purge** allows a user to specify the historical retention properties of a class.  If the date specified is an absolute time such as “Jan 1 1987”, Postgres will discard tuples whose validity expired before the indicated time. **Purge** with no *before* clause is equivalent to “purge before now”. Until specified with a purge command, instance preservation defaults to “forever”.

The user may purge a class at any time as long as the purge date never decreases.  Postgres will enforce this restriction, silently.

Note that the  **purge** command does not do anything except set a parameter for system  operation.  Use *vacuum*(l) to enforce this parameter.

## EXAMPLE

```
--
--Always discard data in the EMP class
--prior to January 1, 1989
--
purge EMP before "Jan 1 1989"
```

```
--
--Retain only the current data in EMP
--
purge EMP
```

## SEE ALSO

vacuum(l).

## BUGS AND CAVEATS

Error messages are quite unhelpful.  A complaint about “inconsistent times” followed by several nine-digit numbers indicates an attempt to “back up” a purge date on a relation.

You cannot purge certain system catalogs (namely, “pg\_class”, “pg\_attribute”, “pg\_am”, and “pg\_amop”) due  to circularities in the system catalog code.

This definition of the  **purge** command is really only useful for non-archived relations, since  tuples will not be discarded from archive relations (they are  never vacuumed).
