Mastering PostgreSQL 11
Expert techniques to build scalable, reliable, and fault-tolerant database applications, 2nd Edition
Hans-Jürgen Schönig
- 450 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Mastering PostgreSQL 11
Expert techniques to build scalable, reliable, and fault-tolerant database applications, 2nd Edition
Hans-Jürgen Schönig
About This Book
Master the capabilities of PostgreSQL 11 to efficiently manage and maintain your database
Key Features
- Master advanced concepts of PostgreSQL 11 with real-world datasets and examples
- Explore query parallelism, data replication, and database performance while working with larger datasets
- Extend the functionalities of your PostgreSQL instance to suit your organization's needs with minimal effort
Book Description
This second edition of Mastering PostgreSQL 11 helps you build dynamic database solutions for enterprise applications using the latest release of PostgreSQL, which enables database analysts to design both the physical and technical aspects of the system architecture with ease.
This book begins with an introduction to the newly released features in PostgreSQL 11 to help you build efficient and fault-tolerant PostgreSQL applications. You'll examine all of the advanced aspects of PostgreSQL in detail, including logical replication, database clusters, performance tuning, monitoring, and user management. You will also work with the PostgreSQL optimizer, configuring PostgreSQL for high speed, and see how to move from Oracle to PostgreSQL. As you progress through the chapters, you will cover transactions, locking, indexes, and optimizing queries to improve performance. Additionally, you'll learn to manage network security and explore backups and replications, while understanding the useful extensions of PostgreSQL so that you can optimize the speed and performance of large databases.
By the end of this book, you will be able to use your database to its utmost capacity by implementing advanced administrative tasks with ease.
What you will learn
- Get to grips with advanced PostgreSQL 11 features and SQL functions
- Make use of the indexing features in PostgreSQL and fine-tune the performance of your queries
- Work with stored procedures and manage backup and recovery
- Master replication and failover techniques
- Troubleshoot your PostgreSQL instance for solutions to common and not-so-common problems
- Perform database migration from MySQL and Oracle to PostgreSQL with ease
Who this book is for
This book is for data and database professionals wanting to implement advanced functionalities and master complex administrative tasks with PostgreSQL 11. Prior experience of database administration with PostgreSQL database will aid in understanding the concepts covered in this book.
Frequently asked questions
Information
Optimizing Queries for Good Performance
- Optimizer internals
- Execution plans
- Partitioning data
- Enabling and disabling optimizer settings
- Parameters for good query performance
- Parallel queries
- JIT compilation
Learning what the optimizer does
Optimizations by example
CREATE TABLE a (aid int, ...); -- 100 million rows CREATE TABLE b (bid int, ...); -- 200 million rows CREATE TABLE c (cid int, ...); -- 300 million rows
CREATE INDEX idx_a ON a (aid); CREATE INDEX idx_b ON b (bid); CREATE INDEX idx_c ON c (cid);
CREATE VIEW v AS SELECT *
FROM a, b
WHERE aid = bid;
SELECT *
FROM v, c
WHERE v.aid = c.cid
AND cid = 4;
Evaluating join options
Nested loops
for x in table1:
for y in table2:
if x.field == y.field
issue row
else
keep doing
Hash joins
Hash join
Sequentialscan table 1
Sequentialscan table 2
Merge joins
Merge join
Sort table 1
Sequential scan table 1
Sort table 2
Sequential scan table 2
Merge join
Index scan table 1
Index scan table 2
Applying transformations
Inlining the view
SELECT *
FROM
(
SELECT *
FROM a, b
WHERE aid = bid
) AS v, c
WHERE v.aid = c.cid
AND cid = 4;