Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Jayadevan Maymala

Rating 3.5 AI initial rating

Discover how to design, develop, and maintain your database application effectively with PostgreSQL About This Book Understand how to utilize the most frequently used PostgreSQL ecosystem-related tools and technologies A hands-on guide focused primarily on providing a practical approach to learning about architecture and design considerations for database architects The book covers PostgreSQL from a data architect's perspective – covering topics from installation from source to designing tables using SQL Power Architect, as well as deciding replication and failover strategies. Who This Book Is For This book is for developers and data architects who have some exposure to databases. It is assumed that you understand the basic concepts of tables and common database objects, including privileges and security. What You Will Learn Compile PostgreSQL from source and understand the PostgreSQL architecture Configure parameters and change default settings for a PostgreSQL server Leverage the logging mechanism to identify errors and suboptimal queries Use replication to scale horizontally Set up backup and recovery processes Tweak parameters to optimize queries and processes Troubleshoot connection errors Use indexes and rewrite queries to improve performance Install and use PostgreSQL extensions Learn how to leverage the command-line client (psql) In Detail PostgreSQL is an incredibly flexible and dependable open source relational database. Harnessing its power will make your applications more reliable and extensible without increasing costs. Using PostgreSQL's advanced features will save you work and increase performance, once you've discovered how to set it up. PostgreSQL for Data Architects will teach you everything you need to learn in order to get a scalable and optimized PostgreSQL server up and running. The book starts with basic concepts like installing PostgreSQL from source and covers theoretical aspects such as concurrency and transaction management. After this

AI Reading Assistant

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

AI guide
【One-Line Pitch】 A practical field guide for developers and data architects who need to run PostgreSQL as production infrastructure—not just write queries against it. It walks from compiling the server from source through process architecture, memory tuning, roles, and replication, so you can make informed design and operations decisions. 【Book Arc】 - **Opening (~0%–10%)**: Establishes the architect's mindset and gets the server built—compiling PostgreSQL from source, inspecting the source tree, and understanding what the build produces. Solves the "I inherited a server I don't understand" problem by starting at the binary level. - **Early (~10%–35%)**: Dissects server architecture: the daemon and its utility processes (checkpointer, writer, WAL writer, autovacuum launcher, stats collector), shared buffers, WAL and its levels, vacuum behavior, and logging/statistics parameters. This is the conceptual core that later tuning depends on. - **Middle (~35%–50%)**: Moves from processes to objects and people—clusters, databases, schemas, `search_path`, roles versus users, and privilege design. Solves the "how do I structure and secure a multi-tenant or modular database" question. - **Late (~50%–80%)**: Shifts to operational practice: the `psql` command-line client, extensions, backup and recovery, and replication/failover strategy selection. (Excerpts do not cover the exact chapter boundaries here.) - **Ending (~80%–100%)**: Performance work—indexing, query rewriting, and parameter tuning—plus troubleshooting connection errors, tying the earlier architecture material back to real incidents. (Excerpts do not cover the closing chapters in detail.) 【Key Takeaways】 - **The daemon is the mandatory process; everything else is a specialist** (Early): The main `postgres` process performs recovery, initializes shared memory, listens for connections, and spawns per-client server processes, while utility processes handle writing, checkpointing, vacuum, and statistics. Knowing who does what is the prerequisite for reading logs and tuning. - **Commits do not write data files—checkpoints do** (Early): A committed change lives in a dirty buffer until the checkpointer flushes it and marks the WAL as applied. This single fact explains crash recovery, I/O spikes, and why checkpoint tuning matters. - **`wal_level` is a strategy switch, not a knob** (Early): `minimal` supports crash recovery only; `archive` enables WAL archiving and point-in-time recovery; `hot_standby` adds what standby read queries need. It can only be set at server start, so choose before deployment, not after. - **`VACUUM` reclaims space for reuse; `VACUUM FULL` rewrites the table** (Early): Ordinary vacuum leaves file size largely unchanged while making space reusable, whereas `VACUUM FULL` creates a new file and copies live rows—effective but disruptive. Match the tool to the goal. - **`work_mem` is per-operation, not per-server** (Middle): It is allocated per sort or hash operation per session, so raising it with many connections can multiply memory use dramatically and push you into swap or OOM. `maintenance_work_mem` is the lever for index builds and `pg_restore`. - **`effective_cache_size` informs the planner; it reserves nothing** (Middle): It tells the optimizer how much disk cache a query can expect, shaping plan choice. Treat it as a planning hint, not an allocation. - **Schemas are a design tool for isolation and modularity** (Middle): Per-user, per-tenant (SaaS), or per-module (ERP) schemas improve security and maintainability, and views over unions can expose supersets—often simpler than splitting into separate databases joined by foreign data wrappers. - **Roles subsume users** (Middle): `CREATE USER` is `CREATE ROLE` plus login; group-style roles such as a read-only reporting role make privilege management and offboarding far safer than per-person grants. 【Reading Tips】 - Deep-read the architecture and memory chapters (roughly the first third); skim the source-compilation walkthrough if you install from packages—but still read the source-tree tour, it explains where features live. - Keep a test instance open while reading. The vacuum, WAL, and `work_mem` demonstrations are far more memorable when you reproduce the size and temp-file numbers yourself. - Treat the replication and backup material as decision frameworks: extract the trade-offs (archive vs. hot standby, logical vs. physical) into your own notes rather than memorizing commands. - Skim `psql` and extension material if you are already fluent; spend that time on logging and statistics parameters, which pay off during incident response. - Watch for version-specific advice—examples target PostgreSQL 9.3, and the text itself notes defaults changed in 9.4. Verify parameter defaults against your actual version. 【Coverage Limits】 This guide is built from stratified excerpts covering the opening through roughly the middle of the book; the client-tools, backup/recovery, replication, and performance-tuning chapters are represented mainly by the book's stated scope rather than detailed content, so specifics there are not verified.
Excerpt 1
a scalable and optimized PostgreSQL server up and running. The book starts with basic concepts like installing PostgreSQL from source and covers theoretical...
View in text
Excerpt 2
ger, relfilenode oid, reltablespace oid, reldatabase oid, relforknumber int2, relblocknumber int8, isdirty bool, usagecount int2); -- Don't want these to be...
View in text
Excerpt 3
roups, such as where to log, when to log, and what to log. An excellent description of the parameters can be found, as usual, in PostgreSQL documentation at...
View in text
Excerpt 4
those who need to see a superset of the data, views can be created on a union of the tables under different schemas. We can implement the preceding use cases...
View in text
Excerpt 5
few system functions and columns that can be used both to understand the theory and to study system behavior in real life. In the next couple of chapters, we...
View in text
Excerpt 6
LECT * was used, the index scan was followed by heap fetch. In the other case, PostgreSQL was able to get the data it wanted from the index and did not have...
View in text
Excerpt 7
here is a parameter called superuser_reserved_connections. This is the number of connection slots that are reserved for PostgreSQL superusers. The default va...
View in text
Excerpt 8
ou are now connected to database "test" as user "postgres". test=# CREATE TABLE myt (id int, nm varchar(20)); CREATE TABLE test=# INSERT INTO myt VALUES(1,'F...
View in text
Tags
AI categories
DatabaseSQLDevOps
ISBN: 1783288604
Publisher: Packt Publishing
Publish Year: 2015
Language: English
Pages: 290
File Format: PDF
File Size: 5.5 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…