Thành Đạt
05/28/2026, 2:41 AMDROP [TEMPORARY] TABLE [IF EXISTS] [db_name.]table_name [FORCE]
Note:
• After a table is dropped, you can use theRECOVERstatement to restore the table within a specified period (1 day by default).
• If DROP Table FORCE is executed, the table will be deleted directly and cannot be recovered without checking whether there are unfinished activities in the database. Generally, this operation is not recommended.
• Once dropped, temporary tables cannot be restored using RECOVER.
@Rocky I've ran DROP TABLE a;, now I want all the data gone too, how can I achieve itRocky
05/28/2026, 2:41 AMDROP TABLE a; and want the data to be physically deleted immediately (instead of waiting for the default 1-day retention period), you have two main options:
1. The "Recover and Force Drop" Method (Recommended)
This is the simplest way to bypass the recycle bin for a table that was already dropped without the FORCE keyword:
1. Restore the table:
sql
RECOVER TABLE a;
2. Drop it again with FORCE:
sql
DROP TABLE a FORCE;
Using the FORCE keyword tells StarRocks to skip the recycle bin and trigger immediate deletion of the metadata and data.
2. Adjust the Recycle Bin Retention
If you cannot recover the table (e.g., because a new table with the same name was created), the data will remain in the "Trash" until it expires. You can shorten this window by modifying the FE configuration:
* FE Parameter: catalog_trash_expire_second (Default: 86400 or 1 day).
* BE Parameter: trash_file_expire_time_sec (Default: 86400 or 1 day).
If you change catalog_trash_expire_second to a very small value (like 60), the background cleanup process will eventually remove the metadata from the recycle bin, which then signals the BEs to move the data to their own trash directories for final deletion.
Summary of what happens after `DROP TABLE`:
* Without FORCE: The table metadata moves to the FE Recycle Bin. Data is kept on the BEs. You can see these items by querying information_schema.recyclebin_catalogs.
* With FORCE: Metadata is deleted immediately. BEs are notified to delete the physical data files.
Note: Even with FORCE, physical disk space release on the OS level might take a few moments as the Backend (BE) processes the file deletions in the background.
References
• faq/operation_maintenance_faq.md
• administration/Data_recovery.md
• faq/shared_data_faq.md
• faq/Others.md
• knowledge/admin_and_operation/shared_data_garbage_cleanup.md
• sql-reference/information_schema/recyclebin_catalogs.md
• using_starrocks/caching/block_cache.md