PURGE

PURGE is an SQL keyword used to permanently erase a table or index from the database. It's typically executed after a DROP command to make certain that the target is no longer recoverable, freeing up disk space. The table space is immediately released back to the system. Unlike the DROP command, PURGE operation cannot be rolled back.

Example

DROP TABLE IF EXISTS employee PURGE;

Output

Query OK, 0 rows affected, 1 warning (0.00 sec)

Explanation

The SQL statement DROP TABLE IF EXISTS employee PURGE; will remove the ‘employee’ table from the database, and the PURGE keyword will make sure to permanently remove it, bypassing the recycle bin.

Example

DROP TABLE employees PURGE;

Output

Table dropped.

Explanation

In the provided SQL statement, DROP TABLE employees PURGE; indicates the removal of the ‘employees’ table. The PURGE keyword in the DROP statement completely removes the table from the database, making recovery via the recycle bin impossible.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.