Skip to Content
PostgreSQL 9.0性能调校
book

PostgreSQL 9.0性能调校

by Posts & Telecom Press, Gregory Smith
May 2024
Intermediate to advanced
407 pages
6h 11m
Chinese
Packt Publishing
Content preview from PostgreSQL 9.0性能调校

第7章 日常维护

PostgreSQL期望能够很容易地进行维护。但与其他数据库一样,繁重的读写和吞吐率会使性能下降。数据库中处理并发读写扩展的方法会留下大量需要清除干净的数据。理解其发生的原因会对确定相关维护执行的频率和周期有很大的帮助。另外一个方法是监控数据库服务器查询执行的效率。

在数据库的设计方案中有一个是必须要考虑的,如何处理多个客户端对同个数据的访问,PostgreSQL使用的是叫做多版本并发控制(MVVC,Multiversion Concurrency Control)的方法来执行这项操作。MVCC也用于BerkeleyDB、Sybase SQL Anywhere、Oracle以及其他众多的数据库产品。它是个常规的技术,没有对PostgreSQL做特别的设置。对MVCC的介绍文档可以浏览以下网页:http://www.postgresql.org/docs/current/static/mvcc-intro.html,但所描述的概念听起来比其本身复杂。通过一些简单的例子可以很容易地理解,下面会进行简单介绍。

理解服务器中是如何实施该内容对预测语句如何执行也是有帮助的,这样可以解释诊断信息。

数据库创建事务后,PostgreSQL会提出一个事务ID计数器,称为事务标识符,用于跟踪事务。当用户向数据库插入新行或更新现有数据时,该操作会插入新行,保存会话的事务ID到字段XID中,也称为xmin。XID最基本的功能就是可以看到事务被提交的相关信息。

当查询或语句开始时(以何种方法确保跟踪取决于正处于什么样的模式,后面会详细讨论),说明当前事务ID应可见。因为这些行是包含在查询结果中的,如果数据行被提交后,它们的插入 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Java I/O, NIO and NIO.2

Java I/O, NIO and NIO.2

Jeff Friesen
Linkerd: Up and Running

Linkerd: Up and Running

Jason Morgan, Flynn

Publisher Resources

ISBN: 9781836202752