> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/13/reference/sql-commands/drop-tablespace.md).

# DROP TABLESPACE

DROP TABLESPACE — 移除一個資料表空間

### 語法

```
DROP TABLESPACE [ IF EXISTS ] name
```

### 說明

DROP TABLESPACE 從系統中移除資料表空間。

資料表空間只能由其所有者或超級使用者移除。資料表空間在移除之前必須清空所有的資料庫物件。即使目前資料庫中沒有物件正在使用資料表空間，其他資料庫中的物件仍可能仍駐留在資料表空間中。另外，如果資料表空間在任何連線中的 [temp\_tablespaces](/13/server-administration/server-configuration/client-connection-defaults.md#19-11-1-cha-ju-de-hang) 設定列表上，則 DROP 可能會因臨時檔案駐留在資料表空間中而失敗。

### 參數

`IF EXISTS`

如果資料表空間不存在，請不要拋出錯誤。在這種情況下發布通知。

*`name`*

資料表空間的名稱。

### 注意

DROP TABLESPACE 不能在交易事務內執行。

### 範例

從系統中移除資料表空間 mystuff：

```
DROP TABLESPACE mystuff;
```

### 相容性

DROP TABLESPACE 是 PostgreSQL 的延伸功能。

### 參閱

[CREATE TABLESPACE](/13/reference/sql-commands/create-tablespace.md), [ALTER TABLESPACE](/13/reference/sql-commands/alter-tablespace.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.postgresql.tw/13/reference/sql-commands/drop-tablespace.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
