0% found this document useful (0 votes)
220 views

PostgreSQL Administration TOC

PostgreSQL Administration Table of Contents Introduction. Creating and Managing Views. Creating Views. Setting Rules for Views. Exercises. Using the psql Client. Connecting to PostgreSQL. Creating Indexes. Understanding Indexes.

Uploaded by

richceo1
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
220 views

PostgreSQL Administration TOC

PostgreSQL Administration Table of Contents Introduction. Creating and Managing Views. Creating Views. Setting Rules for Views. Exercises. Using the psql Client. Connecting to PostgreSQL. Creating Indexes. Understanding Indexes.

Uploaded by

richceo1
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

PostgreSQL Administration

Table of Contents
Introduction............................................................................................6
What this course is about...................................................................7
Installing & Configuring PostgreSQL....................................................8
Pre-installation Tasks.........................................................................9
Downloading and Installing PostgreSQL........................................11
Using Configure Arguments............................................................14
Configuring PostgreSQL to Start on Boot.......................................19
Configuring PostgreSQL for Network Access................................21
Exercises..........................................................................................26
Configuring Secure Access
Using OpenSSL....................................................................................29
OpenSSL Benefits............................................................................30
Enabling SSL...................................................................................31
Issuing Certificates...........................................................................32
Configuring the postmaster For SSL...............................................35
Exercises..........................................................................................37
Using the psql Client............................................................................39
Connecting to PostgreSQL..............................................................40
psql Meta-Commands......................................................................46
Psql Internal Variables.....................................................................53
Exercises..........................................................................................56

Creating & Managing Views................................................................59


Creating Views................................................................................60
Setting Rules for Views...................................................................61
Exercises..........................................................................................64
Creating & Managing Indexes..............................................................66
Understanding Indexes.....................................................................67
PostgreSQL Index Types............................................................69
Creating Indexes..............................................................................71
Indexes on Expressions....................................................................73
Partial Indexes..................................................................................74
Exercises..........................................................................................75
Transactions and Concurrency.............................................................77
Transactions.....................................................................................78
Transaction Isolation........................................................................79
Managing Database Privileges.............................................................82
PostgreSQL Roles............................................................................83
User Roles........................................................................................85
Altering User Roles.........................................................................86
Other Role Properties.......................................................................89
Role Examples............................................................................91
Assigning Users to Roles.................................................................92

One Copley Parkway, Suite 210 Morrisville, NC 27560 Phone: 919.463.0999 Fax: 866-229-3386
www.opentechnologygroup.com
Copyright 2004-2010 Open Technology Group, Inc. All rights reserved.
Copying all or part of this manual, or distributing such copies, is strictly prohibited.

Page 2 of 296

PostgreSQL Administration

Understanding Role Access.............................................................93


Exercises..........................................................................................95
Access Control with GRANT...............................................................97
The GRANT and REVOKE Statements..........................................98
GRANT Options..............................................................................99
Granting Column Level Privileges................................................102
Exercises........................................................................................103
PostgreSQL's Data Organization........................................................105
PostgreSQL Storage.......................................................................106
Managing Table Space Usage........................................................108
PostgreSQL Table Information.................................................110
PostgreSQL Log Directories..........................................................112
Other Directories............................................................................113
Managing PostgreSQL Clusters.....................................................116
Exercises........................................................................................118
Creating & Managing
PostgreSQL Clusters, Tablespaces & Databases................................120
PostgreSQL Tablespaces...............................................................121
Using CREATE TABLESPACE...................................................122
Where Objects Go..........................................................................124
Using CREATE DATABASE.......................................................126
Exercises........................................................................................130
PostgreSQL Schemas.........................................................................132
The Schema....................................................................................133

Managing Schemas........................................................................135
Managing Schema Views..............................................................137
Exercises........................................................................................140
PostgreSQL Logging..........................................................................142
Server Log Files.............................................................................143
Using CSV-Format Log Output.....................................................146
Configuring When to Log Messages.............................................148
Configuring What to Log...............................................................153
Changing Settings..........................................................................158
Exercises........................................................................................159
Backup and Recovery.........................................................................161
Backup using pg_dump.................................................................162
Using pg_dumpall..........................................................................167
Restoring Files with pg_restore and psql.......................................169
Performing File-Level Backups.....................................................171
Exercises........................................................................................172
Continuous Archiving
and Point in Time Recovery (PITR)...................................................174
PostgreSQL Write-Ahead Logs.....................................................175
Making a Base Backup..................................................................179
Recovery Using A Continuous Archive Backup...........................181
Exercises........................................................................................185
Using the PostgreSQL Query Optimizer............................................187
Analyzing and Optimizing Queries...............................................188

One Copley Parkway, Suite 210 Morrisville, NC 27560 Phone: 919.463.0999 Fax: 866-229-3386
www.opentechnologygroup.com
Copyright 2004-2010 Open Technology Group, Inc. All rights reserved.
Copying all or part of this manual, or distributing such copies, is strictly prohibited.

Page 3 of 296

PostgreSQL Administration

Using EXPLAIN to View Execution Plans...................................190


Understanding PostgreSQL's Query Operators.............................193
The Seq Scan operator...........................................................194
The Index Scan Operator..........................................................196
The Sort Operator......................................................................197
The Unique Operator.................................................................199
The Limit Operator...................................................................200
The Aggregate Operator............................................................201
The Append Operator................................................................202
The Result Operator..................................................................203
The Join Operators....................................................................204
The Group and HashAggregate Operators................................206
The Subquery Scan and Subplan Operators..............................207
The TID Scan Operator.............................................................208
The Materialize Operator..........................................................210
Setop Operators.........................................................................211
Improving Query Performance......................................................212
Exercises........................................................................................220
Server Monitoring & Performance Tuning........................................222
Understanding BGWRITER & Shared Buffers.............................223
Server Configuration Variables.....................................................226
Query Optimizer Parameters..........................................................230
Gathering Performance Statistics...................................................234
Disk Performance Tuning..............................................................236

Server Information.........................................................................237
PostgreSQL Visibility Maps..........................................................238
Using The Auto-Vacuum Daemon
............................................................................................................239
About Auto-Vacuum......................................................................240
Exercises........................................................................................245
Improving Network Performance
with PgBouncer..................................................................................246
About PgBouncer...........................................................................247
Pooling Modes...............................................................................248
Downloading & Installing PgBouncer...........................................249
Configuring PgBouncer.................................................................250
Configuration Database Parameters..........................................251
Configuring PgBouncer General Parameters............................254
Setting Logging Parameters......................................................257
Other Configuration Parameters...............................................258
Creating an Authorization File.......................................................260
Launching & Managing PgBouncer..............................................261
Exercises........................................................................................262
Full Text Indexing..............................................................................264
About Full Text Search..................................................................265
About tsearch.................................................................................267
Setting The Text Search Language................................................269
Tsearch & The SQL Statement......................................................271

One Copley Parkway, Suite 210 Morrisville, NC 27560 Phone: 919.463.0999 Fax: 866-229-3386
www.opentechnologygroup.com
Copyright 2004-2010 Open Technology Group, Inc. All rights reserved.
Copying all or part of this manual, or distributing such copies, is strictly prohibited.

Page 4 of 296

PostgreSQL Administration

About Queries................................................................................274
Text Search Operators....................................................................275
Text Search Functions...................................................................276
Indexes...........................................................................................278
Ranking..........................................................................................279
Exercises........................................................................................280
Enabling Hot Standby.........................................................................281
About Hot Standby........................................................................282
Set up WAL Archiving..................................................................283

SSH Key Based Authentication.....................................................284


Configuring Recovery.conf for Hot Standby.................................286
Starting the Secondary Node.........................................................289
Configuring Standby Limits..........................................................290
About the WAL Sender.............................................................291
Other Hot Standby Notes...............................................................293
Questions?..........................................................................................294
Where to Get Help.........................................................................295
The Payroll Database Structure.....................................................296

One Copley Parkway, Suite 210 Morrisville, NC 27560 Phone: 919.463.0999 Fax: 866-229-3386
www.opentechnologygroup.com
Copyright 2004-2010 Open Technology Group, Inc. All rights reserved.
Copying all or part of this manual, or distributing such copies, is strictly prohibited.

Page 5 of 296

You might also like