PosgreSQL 9.0 High Performance中文版瑕疵

本文涉及的产品
云原生数据库 PolarDB MySQL 版,Serverless 5000PCU 100GB
简介:

发表此文不是为了吐槽,而是为了防止更多的受害者出现啊,拿到书后,我就知道,上当了。

让我们对比一下googble book上的原书和此中文版:
http://books.google.com/books?id=OWOAu0GcsqoC&pg=PT310&lpg=PT310&dq=index+bloat+Postgresql&source=bl&ots=Ury_jKQGBo&sig=9hGwS4OmXWxjuynlagw6OoRyoHw&hl=en&sa=X&ei=E-INUt3bMoakyQHqzYFA&ved=0CEQQ6AEwBDgU#v=onepage&q&f=true

复制代码
Measuing index bloat:

Assuming you have a version of PostgreSQL before 9.0,
where VACUUM FULL will bloat indexes, you can easily get
this table into the situation where its data pages can be
cleaned up but not its indexs. Just sparsely deleting some of
the rows in the table, so that no index pages can be 
reclaimed, then issue VACUUM FULL:

DELETE FROM pgbench_accounts
WHERE aid % 2 = 0; 
VACUUM FULL;

The table will be named just "accounts"on PostgreSQL versions before
8.4. Now running the index ratio query shows a very different propotion:

relname | accounts_pkey
index_ration | 0.27
index_size | 43 MB
table_size | 155 MB

Now the idex is 27% of the size of the table--clearly quite bloated compared with the
original, compact representation. While the exact threshold where the ratio is so far
off that an index is obviously bloated varies depending on the structure of the table
and its index, if you take a periodic snapshot of this data it's possible to see if 
bloat growth is increasing or not.
复制代码

看看本书中是怎么翻的,就先说这第一段吧:

原文是:

复制代码
Assuming you have a version of PostgreSQL before 9.0,where VACUUM FULL will bloat indexes, you can easily get this table into the situation where its data pages can be cleaned up but not its indexs. Just sparsely deleting some ofthe rows in the table, so that no index pages can be reclaimed, then issue VACUUM FULL:

DELETE FROM pgbench_accounts
WHERE aid % 2 = 0; 
VACUUM FULL;
复制代码

书中的翻译是:

假设用户所使用的PostgreSQL版本是9.0以前的版本,这些版本中的VACUUM FULL操作会引起索引膨胀,所创建的表可以很容易清理数据页面而不是清理其索引。该操作只是删除表中的某些行,所以没有索引页面可以进行回收,这就是VACUUM FULl引起的问题

如果是我,会翻译成:

假定你有一个9.0版之前的PostgreSQL,那么在此版本中VACUUM FULL会导致索引膨胀:你可以很容易地创造这样一种场景:表的数据页被清除,但索引页却没有得到清除----如果你稀疏地删除表的一些行(因此也保留一些行),这样一来就没有相应的索引页可以被回收;然后你再运行 
VACUUM FULL来 看看: DELETE FROM pgbench_accounts WHERE aid % 2 = 0; VACUUM FULL;

再看第二段:

复制代码
The table will be named just "accounts"on PostgreSQL versions before
8.4. Now running the index ratio query shows a very different propotion:

relname | accounts_pkey
index_ration | 0.27
index_size | 43 MB
table_size | 155 MB

Now the idex is 27% of the size of the table--clearly quite bloated compared with the
original, compact representation. While the exact threshold where the ratio is so far
off that an index is obviously bloated varies depending on the structure of the table
and its index, if you take a periodic snapshot of this data it's possible to see if 
bloat growth is increasing or not.
复制代码

书中翻的是:

复制代码
在PostgreSQL8.4之前的版本中,该表的名称为 "accounts"。现在运行索引比例查询得到的结果会有不同的比例。
relname | accounts_pkey
index_ration | 0.27
index_size | 43 MB
table_size | 155 MB
现在索引的大小紧凑地表示为表的27%。显然相比于原始的大小它膨胀得很厉害。而实际上比例阀值一直关闭,索引膨胀很大程度上与表和索引的结构有关,如果用户执行数据的定期快照,可以看到膨胀是否增长。
复制代码

如果是我来翻,我会翻译成:

复制代码
(顺便提一句)在PostgreS8.4版以前,上述的表名称为普通的"accounts"。现在运行前述的索引比率查询会显示一个非常不同的比例值:

relname | accounts_pkey
index_ration | 0.27
index_size | 43 MB
table_size | 155 MB

现在索引的大小是表大小的27%--很明显与原来的相对紧凑的索引相比发生了膨胀。不过,表明一个索引已经明显膨胀的具体的比例阀值会随着表及其索引的结构而变动,如果你定期建立此类数据的快照,你就有可能看出来膨胀是否明显增长。
复制代码

当真是精品太难得。 





本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/p/3262660.html,如需转载请自行联系原作者


相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
1月前
|
搜索推荐
如何让 SAP UI5 Smart Table 支持多项选择(Multiple-Selection)试读版
如何让 SAP UI5 Smart Table 支持多项选择(Multiple-Selection)试读版
18 0
|
2月前
Google Earth Engine(GEE)——Segmentation.seedGrid和SNIC (Simple Non-Iterative Clustering)案例和错误缺少特征错误分析
Google Earth Engine(GEE)——Segmentation.seedGrid和SNIC (Simple Non-Iterative Clustering)案例和错误缺少特征错误分析
62 0
|
6月前
|
存储 缓存 数据库连接
每日一博 - How To Improve API Performance
每日一博 - How To Improve API Performance
21 0
|
算法
PAT (Basic Level) Practice (中文)1028. 人口普查(20分)
PAT (Basic Level) Practice (中文)1028. 人口普查(20分)
76 0
|
数据库
LeetCode(数据库)- Low-Quality Problems
LeetCode(数据库)- Low-Quality Problems
65 0
PAT (Basic Level) Practice (中文)- 1052 卖个萌(20 分)
PAT (Basic Level) Practice (中文)- 1052 卖个萌(20 分)
78 0
SAP QM中阶执行事务代码QDB1,报错- Inspection severity 001 AQL 0.650 not in sampling schema A01-
SAP QM中阶执行事务代码QDB1,报错- Inspection severity 001 AQL 0.650 not in sampling schema A01-
SAP QM中阶执行事务代码QDB1,报错- Inspection severity 001 AQL 0.650 not in sampling schema A01-
SAP QM启用了Physical Sample Management后检验批有哪些特殊地方?
SAP QM启用了Physical Sample Management后检验批有哪些特殊地方?
SAP QM启用了Physical Sample Management后检验批有哪些特殊地方?
|
SQL 存储 数据采集
【详谈 Delta Lake 】系列技术专题 之 基础和性能(Fundamentals and Performance)
本文翻译自大数据技术公司 Databricks 针对数据湖 Delta Lake 的系列技术文章。众所周知,Databricks 主导着开源大数据社区 Apache Spark、Delta Lake 以及 ML Flow 等众多热门技术,而 Delta Lake 作为数据湖核心存储引擎方案给企业带来诸多的优势。本系列技术文章,将详细展开介绍 Delta Lake。
【详谈 Delta Lake 】系列技术专题 之 基础和性能(Fundamentals and Performance)