DROP TABLE¶
Description¶
The DROP TABLE statement unmounts a table from the catalog and permanently removes its directory and data files from disk (data/<table_name>/).
Syntax¶
(See the Syntax Notation Guide for notation rules).
Basic syntax¶
Full syntax¶
Parameters¶
| Parameter | Description |
|---|---|
<table> |
The name of the table to drop. |
Example¶
Expected Output¶
How It Works¶
- Catalog Lookup: Verifies that the table is currently mounted in the catalog.
- Vector Cleanup: Erases any in-memory vector index handles associated with the table.
- Filesystem Removal: Calls
std::filesystem::remove_all("data/" + tableName)to deletedata.db,<table_name>.vec, and thearchive/directory. - Catalog Unregistration: Removes the table entry from
Catalog::tables.
Errors & Edge Cases¶
| Error Condition | Error Message |
|---|---|
| Table Does Not Exist | No such table: '<table>' |
| Filesystem Deletion Failure | Failed to drop table '<table>' |
Related Commands¶
CREATE TABLE— Create a table.SHOW TABLES— Check remaining tables after dropping.