PostgreSQL for Data Architects
eBook - ePub

PostgreSQL for Data Architects

Jayadevan Maymala

Share book
  1. 272 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

PostgreSQL for Data Architects

Jayadevan Maymala

Book details
Book preview
Table of contents
Citations

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is PostgreSQL for Data Architects an online PDF/ePUB?
Yes, you can access PostgreSQL for Data Architects by Jayadevan Maymala in PDF and/or ePUB format, as well as other popular books in Computer Science & Data Modelling & Design. We have over one million books available in our catalogue for you to explore.

Information

PostgreSQL for Data Architects


Table of Contents

PostgreSQL for Data Architects
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Installing PostgreSQL
Installation options
Downloading and extracting the source
Inspecting the contents
Dependencies to compile the source
Configuring and creating the makefile
Building and creating the executables
Installing and moving the files to where they belong
Inspecting the changes
Initializing a cluster
A quick walk through the directories
Processes created
Important files created
Working with extensions
Summary
2. Server Architecture
Starting with the daemon process
Understanding the shared buffer
Inspecting the buffer cache
Checkpoint
WAL and the WAL writer process
Recovery
Incremental backup and point-in-time recovery
Replication
The background writer
The autovacuum launcher process
The logging process
The stats collector process
The WAL sender and WAL receiver
Sorting in memory with work_mem
Maintenance with maintenance_work_mem
Understanding effective_cache_size
Summary
3. PostgreSQL – Object Hierarchy and Roles
The PostgreSQL cluster
Understanding tablespaces
Managing temporary objects with temporary tablespaces
Views
Databases, schemas, and search_path
Schemas – use cases
Roles and privileges
Summary
4. Working with Transactions
Understanding transactions
ACID properties of transactions
A for atomicity
C for consistency
I for isolation
Read uncommitted
Read committed
Repeatable reads
Serializable
Read committed
Repeatable read
Serializable level
D for durability
PostgreSQL and MVCC
Summary
5. Data Modeling with SQL Power Architect
Tools for databases and their uses
Database design tools
SQL Power Architect – downloading and installing
Creating tables
Generating SQL
Reverse engineering and making changes
Exporting the data model
Profiling
Summary
6. Client Tools
GUI tools and command-line tools
pgAdmin – downloading and installation
Adding a server
The pgAdmin main window
The Query tool
psql – working from the command line
psql – connection options
The power of \d
More meta-commands
Setting up the environment
History of commands
Summary
7. SQL Tuning
Understanding basic facts about databases
Fact 1 – databases are more frequently read from than written to
Fact 2 – data is always read in blocks or pages, not as individual records or columns
Approaches to reducing the number of blocks read/written
Query execution components
Planner
Access methods
Join strategies
Finding the execution plan
Optimization guidelines and catches
Indexing foreign keys
Using SELECT *
Using ORDER BY
Using DISTINCT
Using UNION ALL instead of UNION
Using functions in the FILTER clause
Reducing the number of SQL statements
Reducing function executions
Not using indexes
Partial indexes
Optimizing functions
Summary
8. Server Tuning
Server-wide memory settings
shared_buffers
effective_cache_size
Managing writes, connections, and maintenance
Seek/scan cost and statistics parameters
CPU costs
Materialized views
Partitioned tables
Summary
9. Tools to Move Data in and out of PostgreSQL
Setting up the production database – considerations
COPY
Fast loading with pg_bulkload
pg_dump
Filtering options
pg_dumpall
pg_restore
Summary
10. Scaling, Replication, and Backup and Recovery
Scalability
Vertical scaling
Horizontal scaling
Master-slave(s) with read/write separation
Streaming replication
Configuring primary
Configuring secondary
Making the standby in synch with primary
Connection pooling, load balancing, and failover with pgpool-II
Configuring pgpool-II
Test read/write separation
Test failover
Sharding
Multi-master full replication
Point-in-time recovery
Summary
11. PostgreSQL – Troubleshooting
Connection issues
Authentication and permission issues
Parameter changes not effective
Query not responding
Summary
12. PostgreSQL – Extras
Interesting data types
RANGE
Using network address types
hstore for key-value pairs
json/jsonb
XML
Inserting and verifying XML data
Generating XML files for table definitions and data
Geometry and geography
Foreign Data Wrappers
FDW for files
PostgreSQL FDW
Data wrappers – other aspects
pgbadger
Features over time
Interesting features in 9.4
Keeping the buffer ready
Better recoverability
Easy-to-change parameters
Logical decoding and consumption of changes
Summary
Index

PostgreSQL for Data Architects

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: March 2015
Production reference: 1240315
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-860-1
www.packtpub.com
Cover image by Kai Stachowiak ()

Credits

Author
Jayadevan Maymala
Reviewers
Pascal Charest
Bahman Movaqar
Ângelo Marcos Rigo
Hans-JĂŒrgen Schönig
Stéphane Wirtel
Commissioning Edi...

Table of contents