Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: 唐成

Rating 4.0 AI initial rating

本书分为四大部分,分别为准备篇,基础篇,提高篇和架构篇.准备篇为没有数据库基础的读者准备的,如果读者已经具备了一定的数据库基础,可以跳过其中的一些内容.基础篇介绍了PostgreSQL数据库中的一些基础内容,读者学习完此篇可以完成PostgreSQL数据库的基本日常操作工作.提高篇讲解了一些更深的内容,如PostgreSQL的一些技术内幕,特色功能,优化等方面的内容,读者仔细阅读此篇以便早日成为PostgreSQL数据库高手.架构篇讲解了与PostgreSQL数据库配套使用的一些常用的开源软件及架构设计方面的内容,通过阅读此篇,可以提高读者的眼界和数据库架构设计能力.本书分为四大部分,分别为准备篇,基础篇,提高篇和架构篇.准备篇为没有数据库基础的读者准备的,如果读者已经具备了一定的数据库基础,可以跳过其中的一些内容.基础篇介绍了PostgreSQL数据库中的一些基础内容,读者学习完此篇可以完成基本的PostgreSQL数据库的日常操作工作.提高篇讲解了一些更深的内容,如PostgreSQL的一些技术内幕,特色功能,优化等方面的内容,读者仔细阅读此篇以便早日成为PostgreSQL数据库高手.架构篇讲解了与PostgreSQL数据库配套使用的一些常用的开源软件及架构设计方面的内容,通过阅读此篇,读者可以提高读者的眼界和数据库架构设计能力. Guide to Expert, The Progmatic PostgreSQL

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on path from first login to production-grade PostgreSQL architecture, written for readers who want to move beyond "I can write a SELECT" into internals, tuning, and real deployment design. Best for developers, DBAs, and backend engineers who learn by doing and want a single book that grows with them. 【Book Arc】 - **Opening (~0%–10%)**: Orients you to PostgreSQL's positioning and gets a server running—installation, initdb, environment variables, and the psql workflow. Solves the "blank machine to working instance" problem. - **Early (~10%–35%)**: Builds daily fluency: SQL syntax and clause ordering, psql meta-commands like `\h`, the rich type system (enums, arrays, composite, geometric, bit strings), tables, constraints, partitioning, triggers, indexes, and the lock model including intent locks. - **Middle (~35%–60%)**: Moves under the hood and into operations: the Postmaster process, client drivers across languages, authentication methods, backup/restore with pg_dump/pg_restore, EXPLAIN and plan options, MVCC and VACUUM, checkpoints and WAL, permissions/views, LISTEN/NOTIFY, foreign data wrappers, and parallel query. - **Late (~60%–75%)**: Turns to performance and reliability engineering: filesystem choices for data vs. WAL, statistics views, WAL and checkpoint tuning, index fillfactor and GIN pending lists, and streaming replication with sync/async and cascading standby. - **Ending (~75%+)**: The architecture section broadens to companion open-source software and design patterns around PostgreSQL—excerpts only gesture at this part, so treat it as the "widen your horizon" finale rather than a detailed blueprint. 【Key Takeaways】 - **PostgreSQL's value is operational lightness plus depth** (Opening): small install footprint, runs on modest machines, minutes to set up—yet offers regex in WHERE, multiple procedural languages, and extensible types. This framing justifies choosing it over heavier commercial databases. - **The type system is a feature, not trivia** (Early): enums, arrays, composite and geometric types, and bit-string conversions each have their own I/O and casting rules; mastering them early prevents subtle data-modeling mistakes. - **Constraints and partitioning carry real semantics** (Early): foreign keys reject orphan rows, range partitioning rejects out-of-range inserts, and event triggers can block DDL wholesale—knowing these behaviors is what separates "it ran" from "it's correct." - **Locking works through intent locks** (Early): row-level and table-level locks interact via ROW SHARE/ROW EXCLUSIVE-style intent locks that don't conflict with each other but do conflict with strong table locks—essential for diagnosing contention. - **MVCC leaves dead tuples behind** (Middle): updates write new versions rather than overwriting, so space reclamation depends on VACUUM/AutoVacuum; understanding xmin/xmax explains bloat and why rollback doesn't instantly free space. - **Checkpoints bound recovery time** (Middle): WAL can't grow forever and replay must finish in minutes, so checkpoints flush dirty pages and mark a safe replay start—this is the mental model behind backup and crash recovery. - **Tuning is parameter-and-workload specific** (Late): WAL/checkpoint settings, index fillfactor, GIN pending-list limits, and parallel-query cost parameters each trade space, latency, or write throughput; adjust with evidence from statistics views. - **Replication choices are availability trade-offs** (Late): synchronous replication avoids data loss but risks stalling the primary; multiple or cascading standbys mitigate that, and PostgreSQL 12 moved standby signaling from recovery.conf to standby.signal. 【Reading Tips】 - If you already know SQL, skim the Opening and Early SQL basics and slow down at the type system, locking, and partitioning—those are where PostgreSQL diverges from generic SQL. - Deep-read the Middle section on MVCC, VACUUM, checkpoints, and EXPLAIN; these underpin every later tuning decision and are the hardest conceptual stretch. - Treat the Late tuning chapters as a reference: run the parameter experiments (fillfactor, GIN pending list, parallel costs) on a test instance rather than memorizing values. - For the architecture section, read for vocabulary and design options; the excerpts are thin here, so pair it with current official docs before making production decisions. 【Coverage Limits】 This guide is built from stratified excerpts covering roughly the first three-quarters of the book; the architecture section and any late-book case studies are only lightly represented, so specifics there are not summarized.
Excerpt 1
| 15 (3 rows) 排序子句“ORDER BY”应该在WHERE子句之后,如果顺序错了,执 行时会报错: osdba=# SELECT * FROM student ORDER BY age WHERE age >= 15; ERROR: syntax error at or near "WHERE" L...
View in text
Excerpt 2
VALUES FROM ('2014- 03-01') TO ('2014-04-01') 插入几条数据测试一下: osdba=# insert into sales_detail values(1, 99.99, 2, '2014-01-01', 'tangcheng', 'HangZhou'); INSERT...
View in text
Excerpt 3
ignaled 8.3.2 认证方法介绍 PostgreSQL中支持以下几种验证方法。 ·trust:无条件地允许连接。此方法允许任何可以与PostgreSQL数 据库服务器连接的用户以任意PostgreSQL数据库用户身份进行连接, 不需要口令或任何其他认证。 ·reject:无条件地拒绝连接。reject行可...
View in text
Excerpt 4
此参数需要慎重。 ·parallel_setup_cost:浮点值,设置优化器启动并行进程的成本, 默认值为1000。 ·parallel_tuple_cost:浮点值,设置优化器处理一行数据的成本, 默认值为0.1。 ·min_parallel_table_scan_size:表的大小小于此值,则不会走并 行。...
View in text
Excerpt 5
: [postgres@pg01 pg12data]$ pg_ctl reload server signaled 查看同步状态,命令如下: postgres=# select application_name,client_addr,state, sync_priority, sync_state from p...
View in text
Excerpt 6
e ha_config( ha_groupid int primary key, --每一对主备库,分配一个组ID primary_ip text, --HA组中主数据库的IP standby_ip text,--HA组中备数据库的IP primary_hostid int,--HA组中主数据库的ID,也就是在...
View in text
Excerpt 7
TRIBUTE BY子句后面可以指定分布到哪些数据节点上,也可以 指定分布到一个数据节点组,创建数据节点组的示例如下: CREATE NODE GROUP cgall WITH (dn1, dn2, dn3); 注意,要在所有的Coordinator上都执行上面的SQL,否则在创建 表使用数据节点组时会报如下错误...
View in text
Tags
AI categories
DatabaseSQLBackend
ISBN: 7111665031
Publish Year: 2020
Language: Chinese
Pages: 1542
File Format: PDF
File Size: 7.0 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…