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

# 13.1. 簡介 \#

### 13.1. 簡介 [#](#mvcc-intro) <a href="#mvcc-intro" id="mvcc-intro"></a>

PostgreSQL 為開發人員提供了一套豐富的工具，用來管理對資料的並行存取。在內部，資料一致性是透過多版本模型（多版本並行控制，Multiversion Concurrency Control，MVCC）來維持的。這表示每個 SQL 陳述式看到的，是資料在一段時間之前的快照（一個*資料庫版本*），而不論底層資料目前的狀態為何。這可以防止陳述式看到因並行交易對相同資料列進行更新而產生的不一致資料，為每個資料庫工作階段提供*交易隔離*（transaction isolation）。MVCC 避開了傳統資料庫系統的鎖定方法，將鎖定競爭降到最低，以便在多使用者環境中提供合理的效能。

使用 MVCC 模型而非鎖定來進行並行控制的主要優點是，在 MVCC 中，為了查詢（讀取）資料而取得的鎖定，不會與為了寫入資料而取得的鎖定衝突，因此讀取永遠不會阻擋寫入，寫入也永遠不會阻擋讀取。即使在透過創新的*可序列化快照隔離*（Serializable Snapshot Isolation，SSI）等級提供最嚴格的交易隔離等級時，PostgreSQL 仍然維持這項保證。

對於一般不需要完整交易隔離、而偏好明確管理特定衝突點的應用程式，PostgreSQL 也提供了資料表層級與資料列層級的鎖定功能。不過，適當地使用 MVCC 通常能提供比鎖定更好的效能。此外，應用程式定義的諮詢鎖定（advisory lock）提供了一種取得不與單一交易綁定之鎖定的機制。

***

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


---

# 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/mvcc/mvcc-intro.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.
