> 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/19/reference/sql-commands/sql-droptablespace.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# DROP TABLESPACE

### DROP TABLESPACE

DROP TABLESPACE — 移除資料表空間

### 語法

```

DROP TABLESPACE [ IF EXISTS ] name
```

### 說明

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

資料表空間只能由其擁有者或超級使用者移除。 資料表空間必須清空所有資料庫物件後才能移除。即使目前資料庫中沒有任何物件正在使用該資料表空間，其他資料庫中的物件仍可能存放在該資料表空間中。此外，若該資料表空間列於任何作用中工作階段的 [temp\_tablespaces](https://docs.postgresql.tw/19/server-administration/runtime-config/runtime-config-client.md#GUC-TEMP-TABLESPACES) 設定中，`DROP` 可能因為存放在該資料表空間中的暫存檔而失敗。

### 參數

`IF EXISTS` : 資料表空間不存在時不擲出錯誤；此情況會發出 notice。

*`name`* : 資料表空間的名稱。

### 注意事項

`DROP TABLESPACE` 不能在交易區塊內執行。

### 範例

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

```

DROP TABLESPACE mystuff;
```

### 相容性

`DROP TABLESPACE` 是 PostgreSQL 擴充功能。

### 另請參閱

[CREATE TABLESPACE](https://docs.postgresql.tw/19/reference/sql-commands/sql-createtablespace.md), [ALTER TABLESPACE](https://docs.postgresql.tw/19/reference/sql-commands/sql-altertablespace.md)

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/sql-droptablespace.html)（原文版本：18.6；核對日期：2026-10-03）


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.postgresql.tw/19/reference/sql-commands/sql-droptablespace.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
