DROP TABLE permanently deletes one or more tables and their data from an Amazon Redshift database.
Remove obsolete tables to free storage and simplify schemas. The command is irreversible, so verify backups before running.
Use DROP TABLE table_name;
to delete a single table. Add IF EXISTS
to avoid errors if the table is missing.
Comma-separate table names: DROP TABLE IF EXISTS customers_old, orders_2020;
This executes in a single transaction.
CASCADE
automatically removes dependent objects such as views. RESTRICT
blocks the drop if dependencies exist. Choose based on safety needs.
Yes. Qualify the name: DROP TABLE IF EXISTS analytics.daily_sales;
Ensure your role has ownership or DROP privileges on that schema.
Query pg_table_def
or run SELECT 1 FROM information_schema.tables WHERE table_name='orders';
to confirm existence.
Back up data to S3 with UNLOAD or snapshots.
Use IF EXISTS
to prevent errors in deployment scripts.
Apply RESTRICT
in production to avoid unintended cascade deletions.
Audit drops via system table stl_ddltext
.
Yes. Redshift reclaims storage blocks as soon as the transaction commits.
No standard UNDO exists. Restore from a Redshift snapshot or reload data from S3 backups.
Only briefly during commit. Large tables may hold locks, but Redshift releases resources quickly.