Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
PostgreSQL Cookbook
Table of Contents
PostgreSQL Cookbook
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
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Managing Databases and the PostgreSQL Server
Introduction
Creating databases
Getting ready
How to do it...
How it works...
Creating schemas
How to do it...
How it works...
There's more...
Creating users
How to do it...
How it works...
There's more...
Creating groups
How to do it...
How it works...
There's more...
Destroying databases
How to do it...
How it works...
There's more...
Creating and dropping tablespaces
Getting ready
How to do it...
How it works...
There's more...
Moving objects between tablespaces
Getting ready
How to do it...
How it works...
Initializing a database cluster
How to do it...
How it works...
Starting the server
Getting ready
How to do it...
How it works...
There's more...
Stopping the server
How to do it...
How it works...
There's more...
Displaying the server status
How to do it...
How it works...
Reloading the server configuration files
How to do it...
How it works...
Terminating connections
How to do it...
How it works...
There's more...
2. Controlling Security
Introduction
Securing database objects
How to do it...
How it works...
Controlling access via firewalls
How to do it...
How it works...
Controlling access via configuration files
How to do it...
How it works...
There's more…
Testing remote connectivity
How to do it...
How it works...
Auditing database changes
How to do it...
How it works...
There's more...
Enabling SSL in PostgreSQL
How to do it...
How it works...
There's more...
Testing SSL encryption
How to do it...
How it works...
Encrypting confidential data
How to do it...
How it works...
There's more...
Cracking PostgreSQL passwords
How to do it...
How it works...
3. Backup and Recovery
Introduction
A logical backup of a single PostgreSQL database
Getting ready
How to do it...
How it works...
A logical backup of all PostgreSQL databases
How to do it...
How it works...
There's more...
A logical backup of specific objects
How to do it...
How it works...
File system level backup
How to do it...
How it works...
There's more...
Taking a base backup
How to do it...
How it works...
Hot physical backup and continuous archiving
How to do it...
How it works...
Point-in-time recovery
How to do it...
How it works...
There's more...
Restoring databases and specific database objects
How to do it...
How it works...
There's more...
4. Routine Maintenance Tasks
Introduction
Controlling automatic database maintenance
How to do it...
How it works...
There's more...
Preventing auto freeze and page corruption
How to do it...
How it works...
Preventing transaction ID wraparound failures
How to do it...
Updating planner statistics
How to do it...
How it works...
Dealing with bloating tables and indexes
How to do it...
How it works...
There's more...
Monitoring data and index pages
How to do it...
Routine reindexing
How to do it...
How it works...
There's more...
Maintaining log files
How to do it...
5. Monitoring the System Using Unix Utilities
Introduction
Monitoring CPU usage
Getting ready
How to do it...
How it works...
Monitoring paging and swapping
Getting ready
How to do it...
How it works...
Finding the worst user on the system
Getting ready
How to do it...
How it works...
Monitoring system load
How to do it...
How it works...
Identifying CPU bottlenecks
Getting ready
How to do it...
How it works...
Identifying disk I/O bottlenecks
Getting ready
How to do it...
How it works...
Monitoring system performance
Getting ready
How to do it...
How it works...
Examining historical CPU load
Getting ready
How to do it...
How it works...
There's more...
Examining historical memory load
Getting ready
How to do it...
How it works...
Monitoring disk space usage
Getting ready
How to do it...
How it works...
Monitoring network status
Getting ready
How to do it...
How it works...
6. Monitoring Database Activity and Investigating Performance Issues
Introduction
Checking active sessions
Getting ready
How to do it...
How it works...
There's more...
Finding out what queries users are currently running
Getting ready
How to do it...
How it works...
Getting the execution plan for a statement
Getting ready
How to do it...
How it works...
Logging slow statements
Getting ready
How to do it...
How it works...
Collecting statistics
Getting ready
How to do it...
How it works...
Monitoring database load
Getting ready
How to do it...
How it works...
Finding blocking sessions
Getting ready
How to do it...
How it works...
Table access statistics
Getting ready
How to do it...
How it works...
Finding unused indexes
Getting ready
How to do it...
How it works...
There's more…
Forcing a query to use an index
Getting ready
How to do it...
How it works...
Determining disk usage
How to do it...
How it works...
There's more...
7. High Availability and Replication
Introduction
Setting up hot streaming replication
Getting ready
How to do it...
How it works...
Replication using Slony-I
Getting ready
How to do it...
How it works...
There's more...
Replication using Londiste
Getting ready
How to do it...
How it works...
Replication using Bucardo
Getting ready
How to do it...
How it works...
Replication using DRBD
Getting ready
How to do it...
How it works...
Setting up the Postgres-XC cluster
Getting ready
How to do it...
How it works...
8. Connection Pooling
Introduction
Installing pgpool
Getting ready
How to do it...
How it works...
Configuring pgpool and testing the setup
Getting ready
How to do it...
How it works...
Starting and stopping pgpool
Getting ready
How to do it...
How it works...
Setting up pgbouncer
Getting ready
How to do it...
How it works...
Connection pooling using pgbouncer
Getting ready
How to do it...
How it works...
There's more...
Managing pgbouncer
Getting ready
How to do it...
How it works...
9. Table Partitioning
Introduction
Implementing partitioning
Getting ready
How to do it...
How it works...
There's more
Managing partitions
Getting ready
How to do it...
How it works...
There's more
Partitioning and constraint exclusion
Getting ready
How to do it...
How it works...
Alternate partitioning methods
Getting ready
How to do it...
How it works...
Installing PL/Proxy
Getting Ready
How to do it...
How it works...
Partitioning with PL/Proxy
Getting ready
How to do it...
How it works...
There's more
10. Accessing PostgreSQL from Perl
Introduction
Making a connection to a PostgreSQL database using Perl
Getting ready
How to do it...
How it works...
Creating tables using Perl
Getting ready
How to do it...
How it works...
Inserting records using Perl
Getting ready
How to do it...
How it works...
Accessing table data using Perl
Getting ready
How to do it...
How it works...
Updating records using Perl
Getting ready
How to do it...
How it works...
Deleting records using Perl
Getting ready
How to do it...
How it works...
11. Accessing PostgreSQL from Python
Introduction
Making connections to a PostgreSQL database using Python
Getting ready
How to do it...
How it works...
Creating tables using Python
Getting ready
How to do it...
How it works...
Inserting records using Python
Getting ready
How to do it...
How it works...
Accessing table data using Python
Getting ready
How to do it...
How it works...
Updating records using Python
Getting ready
How to do it...
How it works...
Deleting records using Python
Getting ready
How to do it...
How it works...
12. Data Migration from Other Databases and Upgrading the PostgreSQL Cluster
Introduction
Using pg_dump to upgrade data
Getting ready
How to do it...
How it works...
Using the pg_upgrade utility for a version upgrade
Getting ready
How to do it...
How it works...
Replicating data from other databases to PostgreSQL using GoldenGate
Getting ready
How to do it...
How it works...
Index
← Prev
Back
Next →
← Prev
Back
Next →