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

# 12.11. 限制

### 12.11. 限制 [#](#textsearch-limitations) <a href="#textsearch-limitations" id="textsearch-limitations"></a>

PostgreSQL 文字搜尋功能目前有下列限制：

* 每個詞素（lexeme）的長度必須小於 2 KB。
* `tsvector` 的長度（詞素加上位置）必須小於 1 MB。
* 詞素數量必須小於 2<sup>64</sup>。
* `tsvector` 中的位置值必須大於 0，且不超過 16,383。
* `tsquery` 的 `<N>`（FOLLOWED BY）運算子所指定的比對距離不得超過 16,384。
* 每個詞素最多可有 256 個位置。
* `tsquery` 中的節點數量（詞素加上運算子）必須小於 32,768。

作為比較，PostgreSQL 8.1 文件包含 10,441 個不重複單字，總計 335,420 個單字；最常出現的單字「postgresql」在 655 份文件中共出現 6,127 次。

另一個例子是 PostgreSQL 郵件論壇封存，其中 461,020 封訊息包含 910,989 個不重複單字，共計 57,491,343 個詞素。

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/textsearch-limitations.html)（原文版本：18.6；核對日期：2026-09-07）


---

# 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/the-sql-language/textsearch/textsearch-limitations.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.
