-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# 什么是 Postgres TOAST? | ||
|
||
因为 `postgresql` 的 tuple(行数据)是存在在 `Page` 中的,`Page` 的大小默认为 8KB。postgresql 不允许 tuple 跨页存储,所以当一行数据的某个列数据过大时,比如 `text` 类型的数据,超过了单页的大小,那么 `postgresql` 会将它压缩,切分,并且存储在另外的位置。这种技术就是称为 Toast。 | ||
|
||
PostgreSQL Toast 使用是通过单个字段的大小来进行判断是否触发此机制的,比如一个字段,超过了`toast_tuple_threshold` 的阈值就会触发字段里面的值,要进行TOAST的工作流程,默认这个字段的值,大小要超过2KB,才会触发。 | ||
|
||
Postgres 的存储单位称为页,它们具有固定大小(默认为 8 kB)。固定页面大小为 Postgres 带来了许多优势,即数据管理简单、高效和一致性,但它也有一个缺点:某些数据值可能不适合该页面。 | ||
|