DROP TABLE commands or schema resets remove every user-defined table from a ParadeDB (PostgreSQL) database.
Resetting staging data, re-running migrations, or rebuilding a demo environment often requires wiping every table. Dropping all tables is faster than deleting rows and guarantees a clean slate.
Wrap the operation in a transaction and disable safety features like "psql \set ON_ERROR_STOP" so the whole block rolls back if any object fails to drop.Always verify you are on the correct database first.
Re-create the public
schema after dropping it. This removes tables, views, indexes, and sequences in one command.
Select all table names from pg_tables
and loop through each one in a DO block. This keeps the schema and extensions intact.
1. Connect to your ParadeDB database.
2.Run a transaction-wrapped DO block that iterates over every user table and issues DROP TABLE ... CASCADE
.
Take a fresh logical backup, revoke connections from end-users, and disable triggers if foreign key errors surface. Document the procedure in version control.
Avoid on production databases unless you plan permanent decommissioning. Use TRUNCATE
if you only need to clear data but keep the schema.
.
Only if you have a full backup. Once executed, it deletes all dependent objects.
Yes. Extensions live in pg_catalog
and are not affected by dropping the public
schema.
Yes. All constraints, indexes, and triggers referencing the table are removed with the table.