100% found this document useful (1 vote)
6 views

PostgreSQL for data architects discover how to design develop and maintain your database application effectively with PostgreSQL Maymala instant download

The document is a comprehensive guide titled 'PostgreSQL for Data Architects' by Jayadevan Maymala, focusing on designing, developing, and maintaining database applications using PostgreSQL. It includes various chapters covering installation, server architecture, transactions, data modeling, SQL tuning, and troubleshooting among other topics. Additionally, it provides links to related resources and other PostgreSQL-related books available for download.

Uploaded by

karpafemkeqt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
6 views

PostgreSQL for data architects discover how to design develop and maintain your database application effectively with PostgreSQL Maymala instant download

The document is a comprehensive guide titled 'PostgreSQL for Data Architects' by Jayadevan Maymala, focusing on designing, developing, and maintaining database applications using PostgreSQL. It includes various chapters covering installation, server architecture, transactions, data modeling, SQL tuning, and troubleshooting among other topics. Additionally, it provides links to related resources and other PostgreSQL-related books available for download.

Uploaded by

karpafemkeqt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

PostgreSQL for data architects discover how to

design develop and maintain your database


application effectively with PostgreSQL Maymala
download
https://textbookfull.com/product/postgresql-for-data-architects-
discover-how-to-design-develop-and-maintain-your-database-
application-effectively-with-postgresql-maymala/

Download more ebook from https://textbookfull.com


We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!

Learning PostgreSQL 10 A beginner s guide to building


high performance PostgreSQL database solutions Juba

https://textbookfull.com/product/learning-
postgresql-10-a-beginner-s-guide-to-building-high-performance-
postgresql-database-solutions-juba/

PostgreSQL 10 Administration Cookbook Over 165


effective recipes for database management and
maintenance in PostgreSQL 10 4th Edition Simon Riggs

https://textbookfull.com/product/postgresql-10-administration-
cookbook-over-165-effective-recipes-for-database-management-and-
maintenance-in-postgresql-10-4th-edition-simon-riggs/

Procedural Programming with PostgreSQL PL/pgSQL: Design


Complex Database-Centric Applications with PL/pgSQL 1st
Edition Baji Shaik

https://textbookfull.com/product/procedural-programming-with-
postgresql-pl-pgsql-design-complex-database-centric-applications-
with-pl-pgsql-1st-edition-baji-shaik/

PostgreSQL High Availability Cookbook Master over 100


recipes to design and implement a highly available
server with the advanced features of PostgreSQL 2nd
Edition Shaun M. Thomas
https://textbookfull.com/product/postgresql-high-availability-
cookbook-master-over-100-recipes-to-design-and-implement-a-
highly-available-server-with-the-advanced-features-of-
PostgreSQL Up and Running A Practical Guide to the
Advanced Open Source Database Regina O. Obe

https://textbookfull.com/product/postgresql-up-and-running-a-
practical-guide-to-the-advanced-open-source-database-regina-o-
obe/

Learn PostgreSQL - Second Edition -.-

https://textbookfull.com/product/learn-postgresql-second-edition/

PostgreSQL Up and Running A Practical Guide to the


Advanced Open Source Database 3rd Edition Regina O. Obe

https://textbookfull.com/product/postgresql-up-and-running-a-
practical-guide-to-the-advanced-open-source-database-3rd-edition-
regina-o-obe/

Beginning PostgreSQL on the Cloud: Simplifying Database


as a Service on Cloud Platforms Baji Shaik

https://textbookfull.com/product/beginning-postgresql-on-the-
cloud-simplifying-database-as-a-service-on-cloud-platforms-baji-
shaik/

Idea Searching for Design How to Research and Develop


Design Concepts David Bramston

https://textbookfull.com/product/idea-searching-for-design-how-
to-research-and-develop-design-concepts-david-bramston/
PostgreSQL for Data Architects

Discover how to design, develop, and maintain your


database application effectively with PostgreSQL

Jayadevan Maymala

BIRMINGHAM - MUMBAI
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 ([email protected])


Credits

Author Project Coordinator


Jayadevan Maymala Judie Jose

Reviewers Proofreaders
Pascal Charest Maria Gould
Bahman Movaqar Clyde Jenkins
Ângelo Marcos Rigo Chris Smith
Hans-Jürgen Schönig Jonathan Todd
Stéphane Wirtel
Indexer
Commissioning Editor Hemangini Bari
Anthony Albuquerque
Graphics
Acquisition Editor Sheetal Aute
Sonali Vernekar Abhinash Sahu

Content Development Editors Production Coordinator


Rahul Nair Aparna Bhagat
Sharvari Tawde
Cover Work
Technical Editor Aparna Bhagat
Shashank Desai

Copy Editor
Relin Hedly
About the Author

Jayadevan Maymala is a database developer, designer, and architect. He started


working with the Oracle database in 1999. Over the years, he has worked with DB2,
Sybase, and SQL Server. Of late, he has been working with open source technologies.
His database of choice is PostgreSQL. In his career, he has worked in different
domains spanning supply chain management, finance, and travel. He has spent
an equal amount of time working with databases supporting critical transaction
processing systems as well as data warehouses supporting analytical systems.

When he is not working on open source technologies, he spends time reading and
updating himself on economic and political issues.

I would like to thank my wife, Uma, for putting up with my


marathon writing sessions over weekends. I am also deeply indebted
to the PostgreSQL community, which has individuals who are
always promptly replying to my basic and not-so-basic queries.
It's an amazing team that has been working tirelessly to build such
a great database and then give it away for free with such liberal
licensing terms. Thank you.
About the Reviewers

Pascal Charest is a cutting-edge technology professional working with a very wide


array of open source technologies.

He is currently leading system administrators in strategic planning of networked


infrastructures and is often consulted for system architecture design. He can be
reached via his LinkedIn profile at http://www.linkedin.com/in/pascalcharest.

I'd like to thank Anthony and Zachary for keeping me awake,


day and night.

Bahman Movaqar has been developing, deploying, and delivering software


for the past 14 years, ranging from embedded operating systems to ERP
implementations. He's an open source believer and a passionate amateur
chess player. He blogs at http://bahmanm.com/.

I'd like to thank my lovely wife, Nahid, who has taught me how to
be strong.
Ângelo Marcos Rigo has a strong background in web development since
1998, focusing on content management systems. For the past 7 years, he has been
managing, customizing, and developing extensions for Moodle LMS. He can be
reached at his website http://www.u4w.com.br/novosite/index.php for CMS or
Moodle LMS consulting. He has reviewed Moodle Security, Packt Publishing.

I would like to thank my wife, Janaina de Souza, and my daughter,


Lorena Rigo, for their support when I was away reviewing this book.

Hans-Jürgen Schönig has been involved in professional PostgreSQL training,


consulting, and support for more than 15 years now. He and his company Cybertec
Schönig & Schönig GmbH (http://www.cybertec.at/) are serving clients around
the globe and have worked on some of the world's largest PostgreSQL deployments.

Stéphane Wirtel is an enthusiast software craftsman who is interested in high


availability, replication, and distributed systems. Since 2000, he has been using
PostgreSQL with the Python programming language. Stephane gives talks on Python
and PostgreSQL in several conferences in Europe. The last one was called Python &
PostgreSQL, a Wonderful Wedding. He is also a former core developer of the Odoo
project, having worked on it for 6 years.

Stéphane is also a member of the Python Software Foundation and the


EuroPython Society. He promotes the Python programming language via the
PythonFOSDEM event at Brussels. You can reach him at http://wirtel.be/
or via Twitter @matrixise.

He works for Mgx.IO, a company that specializes in Python and Erlang


developments. You can reach this company at http://mgx.io/ or via Twitter
@mgxio. He has also reviewed the books Getting Started with PhantomJS and
PhantomJS Cookbook, both by Packt Publishing.

I would like to thank my wife, Anne, my daughter, Margaux,


my family and friends for their support, and the PostgreSQL
and Python communities for the awesome tools.
www.PacktPub.com

Support files, eBooks, discount offers, and more


For support files and downloads related to your book, please visit
www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.
com and as a print book customer, you are entitled to a discount on the eBook copy.
Get in touch with us at [email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles,


sign up for a range of free newsletters and receive exclusive discounts and offers
on Packt books and eBooks.
TM

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser

Free access for Packt account holders


If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view 9 entirely free books. Simply use your login credentials for
immediate access.
Table of Contents
Preface vii
Chapter 1: Installing PostgreSQL 1
Installation options 1
Downloading and extracting the source 2
Inspecting the contents 3
Dependencies to compile the source 4
Configuring and creating the makefile 5
Building and creating the executables 8
Installing and moving the files to where they belong 9
Inspecting the changes 10
Initializing a cluster 11
A quick walk through the directories 14
Processes created 17
Important files created 17
Working with extensions 18
Summary 19
Chapter 2: Server Architecture 21
Starting with the daemon process 21
Understanding the shared buffer 23
Inspecting the buffer cache 25
Checkpoint 29
WAL and the WAL writer process 32
Recovery 34
Incremental backup and point-in-time recovery 34
Replication 34
The background writer 36
The autovacuum launcher process 37

[i]
Table of Contents

The logging process 41


The stats collector process 46
The WAL sender and WAL receiver 49
Sorting in memory with work_mem 49
Maintenance with maintenance_work_mem 51
Understanding effective_cache_size 53
Summary 54
Chapter 3: PostgreSQL – Object Hierarchy and Roles 55
The PostgreSQL cluster 55
Understanding tablespaces 56
Managing temporary objects with temporary tablespaces 59
Views 61
Databases, schemas, and search_path 61
Schemas – use cases 67
Roles and privileges 67
Summary 72
Chapter 4: Working with Transactions 73
Understanding transactions 73
ACID properties of transactions 76
A for atomicity 76
C for consistency 76
I for isolation 76
D for durability 85
PostgreSQL and MVCC 86
Summary 90
Chapter 5: Data Modeling with SQL Power Architect 91
Tools for databases and their uses 91
Database design tools 93
SQL Power Architect – downloading and installing 93
Creating tables 95
Generating SQL 97
Reverse engineering and making changes 100
Exporting the data model 101
Profiling 102
Summary 103
Chapter 6: Client Tools 105
GUI tools and command-line tools 105
pgAdmin – downloading and installation 105
Adding a server 106

[ ii ]
Table of Contents

The pgAdmin main window 108


The Query tool 111
psql – working from the command line 114
psql – connection options 114
The power of \d 115
More meta-commands 117
Setting up the environment 120
History of commands 121
Summary 122
Chapter 7: SQL Tuning 123
Understanding basic facts about databases 123
Fact 1 – databases are more frequently read from than written to 123
Fact 2 – data is always read in blocks or pages, not as
individual records or columns 124
Approaches to reducing the number of blocks read/written 125
Query execution components 125
Planner 126
Access methods 126
Join strategies 127
Finding the execution plan 128
Optimization guidelines and catches 130
Indexing foreign keys 130
Using SELECT * 132
Using ORDER BY 133
Using DISTINCT 134
Using UNION ALL instead of UNION 134
Using functions in the FILTER clause 134
Reducing the number of SQL statements 137
Reducing function executions 138
Not using indexes 140
Partial indexes 142
Optimizing functions 143
Summary 145
Chapter 8: Server Tuning 147
Server-wide memory settings 147
shared_buffers 147
effective_cache_size 148
Managing writes, connections, and maintenance 149

[ iii ]
Table of Contents

Seek/scan cost and statistics parameters 151


CPU costs 155
Materialized views 157
Partitioned tables 160
Summary 165
Chapter 9: Tools to Move Data in and out of PostgreSQL 167
Setting up the production database – considerations 167
COPY 168
Fast loading with pg_bulkload 171
pg_dump 173
Filtering options 175
pg_dumpall 176
pg_restore 176
Summary 178
Chapter 10: Scaling, Replication, and Backup and Recovery 179
Scalability 179
Vertical scaling 181
Horizontal scaling 182
Master-slave(s) with read/write separation 182
Streaming replication 184
Connection pooling, load balancing, and failover with pgpool-II 189
Sharding 199
Multi-master full replication 201
Point-in-time recovery 202
Summary 206
Chapter 11: PostgreSQL – Troubleshooting 207
Connection issues 207
Authentication and permission issues 208
Parameter changes not effective 210
Query not responding 212
Summary 216
Chapter 12: PostgreSQL – Extras 217
Interesting data types 217
RANGE 218
Using network address types 220
hstore for key-value pairs 222
json/jsonb 224
XML 227
Inserting and verifying XML data 228
Generating XML files for table definitions and data 228

[ iv ]
Table of Contents

Geometry and geography 229


Foreign Data Wrappers 229
FDW for files 230
PostgreSQL FDW 231
Data wrappers – other aspects 232
pgbadger 233
Features over time 236
Interesting features in 9.4 236
Keeping the buffer ready 236
Better recoverability 238
Easy-to-change parameters 238
Logical decoding and consumption of changes 239
Summary 240
Index 241

[v]
Preface
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 (such as installing PostgreSQL from source) and
covers theoretical aspects (such as concurrency and transaction management). After
this, you'll learn how to set up replication, use load balancing to scale horizontally,
and troubleshoot errors.

As you continue through this book, you will see the significant impact of
configuration parameters on performance, scalability, and transaction management.
Finally, you will get acquainted with useful tools available in the PostgreSQL
ecosystem used to analyze PostgreSQL logs, set up load balancing, and recovery.

What this book covers


Chapter 1, Installing PostgreSQL, provides an overview of the process to install
PostgreSQL from source. The chapter covers the prerequisites to compile from
source, and the process to initialize a cluster in Unix/Linux environment. It also
covers the directory structure.

Chapter 2, Server Architecture, covers the important processes started when we start a
PostgreSQL cluster and how they work along with the memory structures to provide
the functionality expected from a database management system.

[ vii ]
Preface

Chapter 3, PostgreSQL – Object Hierarchy and Roles, explains various object types and
objects provided by PostgreSQL. Important concepts such as databases, clusters,
tablespaces, and schemas are covered in this chapter.

Chapter 4, Working with Transactions, covers ACID properties of transactions, isolation


levels, and how PostgreSQL provides them. Multiversion concurrency control is
another topic dealt with in this chapter.

Chapter 5, Data Modeling with SQL Power Architect, talks about how we can model
tables and relationships with SQL Power Architect. Some of the aspects that should
be considered when we choose a design tool are also covered in this chapter.

Chapter 6, Client Tools, covers two clients tools (pgAdmin: a UI tool and psql: a
command-line tool). Browsing database objects, generating queries, and generating
the execution plan for queries using pgAdmin are covered. Setting up the
environment variables for connecting from psql, viewing history of SQL commands
executed, and meta-commands are also covered in this chapter.

Chapter 7, SQL Tuning, explains query optimization techniques. To set the context,
some patterns about database use and theory on how the PostgreSQL optimizer
works are covered.

Chapter 8, Server Tuning, covers PostgreSQL server settings that have significant
impact on query performance. These include memory settings, cost settings,
and so on. Two object types: partitions and materialized views are also
covered in this chapter.

Chapter 9, Tools to Move Data in and out of PostgreSQL, covers common tools/utilities,
such as pg_dump, pg_bulkload, and copy used to move data in and out
of PostgreSQL.

Chapter 10, Scaling, Replication, and Backup and Recovery, covers methods that
are usually used for achievability. A step-by-step method to achieve horizontal
scalability using PostgreSQL's streaming replication and pgpool-II is also presented.
Point-in-time recovery for PostgreSQL is also covered in this chapter.

Chapter 11, PostgreSQL – Troubleshooting, explains a few of the most common


problems developers run into when they start off with PostgreSQL and how
to troubleshoot them. Connection issues, privilege issues, and parameter setting
issues are also covered.

Chapter 12, PostgreSQL – Extras, covers quite a few topics. Some interesting data types
that every data architect should be aware of, a couple of really useful extensions, and
a tool to analyze PostgreSQL log files are covered. It also covers a few interesting
features available in PostgreSQL 9.4.

[ viii ]
Preface

What you need for this book


A computer with access to the Internet is mandatory. It will definitely help if the
computer is running on a Unix/Linux operating system.

Who this book is for


You are expected to have some exposure to databases. Basic familiarity with
database objects such as tables and views is expected. You will find this book really
useful if you have no or a little exposure to PostgreSQL. If you have been working
with PostgreSQL for a few years, you should still find a few useful commands that
you were not aware of or a couple of optimization approaches you have not tried.
You will also gain more insight into how the database works.

Conventions
In this book, you will find a number of text styles that distinguish among different
kinds of information. Here are some examples of these styles and an explanation of
their meaning.

Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows:
"We will use the following wget command to download the source."

A block of code/SQL at psql prompt as well as the output from the server at psql is
set as follows:
CREATE TABLE emp(id serial, first_name varchar(50));

Commands executed at shell/command prompt, the output, and parameters and


settings are formatted as follows:
[root@MyCentOS ~]# ps f -U postgres
PID TTY STAT TIME COMMAND
1918 tty1 S 0:00 /usr/local/pgsql/bin/postgres

New terms and important words are shown in bold.

[ ix ]
Preface

Warnings or important notes appear in a box like this.

Tips and tricks appear like this.

Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or disliked. Reader feedback is important for us as it helps
us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail [email protected], and mention


the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.

Downloading the example code


You can download the example code files from your account at http://www.
packtpub.com for all the Packt Publishing books you have purchased. If you
purchased this book elsewhere, you can visit http://www.packtpub.com/support
and register to have the files e-mailed directly to you.

[x]
Preface

Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you could report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your
submission will be accepted and the errata will be uploaded to our website or added
to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/


content/support and enter the name of the book in the search field. The required
information will appear under the Errata section.

Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all
media. At Packt, we take the protection of our copyright and licenses very seriously.
If you come across any illegal copies of our works in any form on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.

Please contact us at [email protected] with a link to the suspected


pirated material.

We appreciate your help in protecting our authors and our ability to bring you
valuable content.

Questions
If you have a problem with any aspect of this book, you can contact us at
[email protected], and we will do our best to address the problem.

[ xi ]
Installing PostgreSQL
This chapter gives you an overview of the process to install PostgreSQL from the
source. The system used for installation and providing examples in the following
sections is a 64-bit CentOS (6.4) machine. Other Unix/Linux systems typically have
similar commands. For those using Windows systems, there is a set of utilities
available at http://sourceforge.net/projects/unxutils/, which makes it
possible to execute most of the Unix commands (find, grep, cut, and so on) in the
Windows environment. The steps to be followed to install PostgreSQL on Windows
are very different compared to those for Unix/Linux systems and are not covered in
this chapter.

Installation options
There are many possible ways to install PostgreSQL on a system. For Windows,
downloading the Graphical Installer and using this is the easy way. For Linux systems
such as Red Hat Enterprise Linux or CentOS, we could either use Yellow dog Updater
Modified (yum) or Red Hat Package Manager or RPM Package Manager (rpm)
commands to install PostgreSQL. For Ubuntu, PostgreSQL can be installed using the
apt-get command, which in turn works with Ubuntu's Advanced Packaging Tool
(APT). While these options work, we do not get to see what is happening when we
execute these commands, except, of course, that the database gets installed.

Then there are situations where we might want to build from the source.
Assume that all we have is one production server and one development or staging
server. We are on version 9.3. Version 9.4 is about to be released and there are
quite a few interesting features in 9.4 that we want to try out. If we want to install 9.4
in the test server and use it alongside 9.3, without the installations stepping on each
other's toes, compiling from the source with the --prefix= option and specifying
different installation directories is the right approach. We could also set different
default ports. It's also possible that the new version (source) is ready, but the
package for our Linux distribution is not ready yet.

[1]
Installing PostgreSQL

We might use a flavor of Linux for which an installation package is not available at
all. Installation from source is the way forward in these situations. One advantage
with installing from the source is that we don't have to worry too much about
which package to download, the version of operating system (CentOS 6.3 or 6.4?),
architecture (32 bit or 64 bit), and so on. These are more or less irrelevant. Of course,
we should be using an operating system/architecture that is supported by the
database, but that's about it! We also need to download and install all the tools and
utilities necessary to compile and make the software, in this case, PostgreSQL.

So let's get down to it.

Downloading and extracting the source


The source for PostgreSQL is available at http://www.postgresql.org/ftp/
source/.

We can see a number of versions all the way down to version 1 when it was called
Postgres95 and up to the latest production and beta versions. If you belong to the
group who believe that one shouldn't try software that is not at least a few months
old, so that its teething issues are resolved, you should opt for the last-but-one
version. It's a good idea to opt for the latest stable version. The latest versions have
added quite a few very useful features, such as materialized views and an improved
set of JSON functions and operators.

We will use the following wget command to download the source:


wget http://ftp.postgresql.org/pub/source/v9.3.0/postgresql-
9.3.0.tar.gz

It's a good idea to opt for the latest stable version.

Executing this command will give us a window that looks like this:

[2]
Chapter 1

As we can see, the tarred and gzipped source code comes to about 21 MB. As an
aside, the installation files of Oracle—the big RDBMS out here—weighs over 2.2 GB.

The files can be extracted using the following command:


tar -xvf postgresql-9.3.0.tar.gz

The tar command is used to create or extract TapeARchive files. In the preceding
command, the x option is used to extract, v for verbose is used so that we can see
the list of files and folders getting extracted, and the f option is for, well, passing
the name of the file, which will undergo the extraction process. We might need to
provide the z option, so the command will be tar -xzvf if the preceding code in the
tar command does not work. Some versions of tar are intelligent enough to figure
out whether it is a gzipped file or not and will unzip it automatically. The untarred
unzipped files come to around 115 MB.

Inspecting the contents


Let's inspect the contents:
cd postgresql-9.3.0

find ./ -maxdepth 1 -type d

The find command searches for files meeting specific criteria. Here, we instructed
find to limit itself to scanning just one level of subdirectories using maxdepth 1. We
used the type option along with d to tell find that we need files of type directory, as
shown in the following screenshot:

There are four directories:

• src: This directory has most of the core code, namely, code for the backend
processes, optimizer, storage, client utilities (such as psql) and code to
take care of replication, and so on. It also contains the makefiles for various
distributions. For example, we have the files Makefile.hpux, Makefile.
linux, Makefile.openbsd, and Makefile.sco under src/makefile.

[3]
Installing PostgreSQL

• doc: This directory has the source for documentation written in DocBook,
DocBook being an application of Standard Generalized Markup Language
(SGML). It's possible to generate documentation in an HTML format, PDF
format, and a few other formats.
• contrib: This directory is where many extensions are available. These
are add-on modules that do not form part of the core installation, but can
be installed as needed. For example, those who have to connect to other
PostgreSQL databases can install the Foreign Data Wrapper extension:
postgres_fdw. For those who want to access the contents of a file on the
server from a table, there is the file_fdw extension.
• config: This directory contains a few macros that help you configure and
compile the package.

Now let's move on to the dependencies, configuration options, and the actual
installation itself.

Dependencies to compile the source


To compile and build PostgreSQL from source, we need GNU Make Version 3.8 or
higher. The gmake -v command will tell us whether we have gmake and its version.

A compiler is also necessary. GNU Compiler Collection (GCC) is one such toolset
that is included in almost all the Unix systems. The gcc -v command will provide
you with the version of gcc as well as options with which it was configured on the
system, as shown in the following screenshot:

We can use the following commands to install the necessary packages if


they are missing:
• On Ubuntu: sudo apt-get install build-essential
• On RHEL/CentOS: sudo yum groupinstall 'Development
Tools'

[4]
Chapter 1

The process of building a package from source involves preprocessing the source
(including the header files, expanding macros, and so on), compiling, assembly, and
linking (linking the libraries). The make utility automates the process of building the
executable from source code. The make command uses a makefile, which contains
rules on how to build the executables.

Other than GNU Make and a compiler, there is nothing else that is really necessary
to continue. However, it is better to have at least the following two components:

• readline: The GNU readline library is very useful once we start using
psql, the PostgreSQL command-line client, which is covered later. Having
readline helps us work in a very "bash-like" environment, using Tab
to autocomplete/suggest table names and up and down keys to browse
command history, and so on and so forth. It also helps to have zlib in
place before we proceed with the installation.
• zlib: This compression library can be handy when we are taking backups
(a process definitely to be followed when we have a database).

Adding SQL/XML support will also be useful as sooner or later we will want to
extract data from tables in an XML format or load data from the XML files to tables.
Still, this might not be as useful as the other two, namely, readline and zlib.

Configuring and creating the makefile


The next step is to execute configure. This is a shell script which will run, to quote
documentation, a number of tests to determine several system dependent variables.
It will also create many files that will be used during compilation. We can get an idea
about the options by executing the following command:
./configure --help > /tmp/config.txt

We can vi /tmp/config.txt and verify that there are over 80 options that can be
used. These options can be broadly grouped into the following categories:

• Related to choosing directories. If architecture-independent files go to /usr/


local/pgsql or elsewhere, where should the binaries go, where should the
documentation files go, and so on.
• Related to debugging, profiling, tracing, and so on to be used with care
in production.

[5]
Installing PostgreSQL

• Related to choosing nondefault settings for parameters such as blocksize,


port, and segment size. Changing default setting for parameters such as
blocksize can have significant impact on performance. So, we need to be
cautious here. Changing the default port is a good idea from a security
perspective. It can be changed later in the configuration file also.
• Related to enabling options, such as OpenSSL support, SELinux support,
and LDAP support.
• Related to building modules for several languages (Perl, Python, and
PL/TcL).
• Related to disabling a few features (such as zlib and readline).

Pay attention to the --prefix option. If you would like to


do a clean upgrade without causing disruption to the existing
environment, provide a directory in which the installation files
should be written to. This way, each version will be in a different
directory. For example:
./configure --prefix=/opt/pg/9.3

When we run ./configure, it's likely that we get an output like this:

The output tells us that readline is not available. However, if we list installation
packages, it is very much there. The reason is that readline-devel is missing. It
contains files needed by programs (such as psql) that use the readline library. This
can be installed using the following command:
yum install readline-devel.x86_64

[6]
Chapter 1

It also installs ncurses-devel. You will have to execute the command using sudo
or root. You might also get a similar error for zlib, although zlib itself is already
installed. Again, the corrective action is to install devel, in this case, zlib-devel.

Once this is done, we can run configure again and it should go through without
any issues, as shown in the following screenshot:

The two files are now created in the current directory in addition to a few more files
in subdirectories. One is config.status and the other (config.log. config.
status) is a bash script that can be executed to recreate the configuration. The
config.log file can be reviewed to understand the various options used, variables,
and errors, if any. It's possible that the config.log file has a few errors that are
marked fatal, and the compilation process can still be completed without any issue.

[7]
Installing PostgreSQL

Building and creating the executables


This step compiles all the source files and generates the executables. The makefile
created in the configure step is used by the gmake utility. These files are not copied
to standard directories, such as bin, /usr/bin, /usr/local/bin, and so on. We
have the option to make all the options available (the contrib modules, source,
and so on), or just the core. It's also possible to build just the core now and add the
necessary contrib modules later on. We will build everything now, rather than
adding the necessary modules later. Hence, the command is:
gmake world

The process takes a few minutes to complete, and in the end says PostgreSQL,
contrib, and documentation successfully made. Ready to install, as
shown in the following screenshot:

[8]
Another Random Scribd Document
with Unrelated Content
(which was a clam-digging village) was held at high sea. It was
expected of the minister that he should preach a full and complete
sermon over the remains.
The bustling old undertaker, in shabby black broadcloth and with
his iron-grey hair brushed forward over his ears, giving him the look of
a super-serious monkey, marshaled the audience after the sermon to
march down one aisle past the coffin and out the other aisle.
The grim, mahogany-hued face of Captain Jethro Potts, the lines of
which even the touch of death could not soften, confronted his
neighbors from the coffin. His countenance was not composed as the
dead usually are; but looked as though he lay there in ambush, ready
to jump out at one. There was even the glitter of a beady eyeball
behind the thin lashes drawn down over his eye.
"He looks mighty like he was a-watchin' of ye," observed the
undertaker to Tobias. "I never see a corp' more nateral."
"You said it. 'Nateral' is right," agreed the lightkeeper. "I cal'late
Uncle Jethro has got something to spring on his rel'tives. He's watchin'
of 'em yet."
Whether the other members of the family had the same feeling
about the dead man's alertness or not, they saw the lid of the coffin
screwed down with complacency. Tobias was one of those who bore
the coffin out to the churchyard and lowered it into the newly opened
grave, the sides of which had to be bulkheaded to keep the sand from
caving in.
Following the prayer there was a little lingering in the graveyard.
Judge Waddams had announced that he would read the dead man's
will in his office an hour later. Those interested began drifting back to
the village along the white shell road.
CHAPTER VI
DEAD MEN'S SHOES

A dozen or more grim-faced men and women were gathered in the


lawyer's office when Tobias Bassett entered. He had seen them all at
the church and grave, but there had been no opportunity to greet
personally the Pottses, the Bassetts and the Dawsons, names which for
the most part made up the roster of Captain Jethro's immediate family.
The lightkeeper proceeded to speak to each in turn. He was of no
grim disposition himself, and was sport enough in any case to shake
hands with his deadliest enemy before the battle.
His smile and cheerful word were for all, even for Icivilla Potts who
was, of all the dead captain's relatives, the one who considered that
Tobias's interest in the will should be infinitesimal. She had lived next
door to Captain Jethro's little box of a house for thirty years, and had
kept a sharp and hungry eye upon him and his affairs during all of that
time.
"Yes," she was saying, "he depended upon me for everything. If
Cap'n Jethro had been my own father I could have taken no more
pains with him."
"I don't doubt it! I don't doubt it!" put in Mrs. Andrew Dawson, as
sharp as any sparrow. "Cap'n Jethro told me that you'd interfered with
everything you could, the whole endurin' time. He said, the Cap'n did,
that you'd change the sun and moon, let alone the stars, in their
courses, if so be you could!"
"Haw! Haw!" chortled Isaac Bassett, a bewhiskered old man whose
bleary eyes and empurpled nose told the tale of much secret tippling.
"Le's speak right out in meetin' and tell all we know. Who'll be the first
of you women to tell how ye fished ter get the old Cap'n ter come and
live with ye?"
"Why, Ike Bassett! How you talk!" was the chorus of denial.
"'Tis so," chuckled Isaac. "Jethro told me once that purt' nigh
every woman that was any kin to him—and some that warn't—had
offered to make a home for him. Come to think of it, though," he
added, turning a bleary eye on Tobias, "there was one he said that
hadn't bothered him none that-a-way. How is your sister Heppy, Tobe?"
"Wal, she ain't no younger," said the lightkeeper, cheerfully.
"Otherwise she is spry."
Judge Waddams entered at this point, before the tide of family
acrimony could rise higher. He was a soft-stepping, palm-rubbing man,
with a bald crown and iron-grey burnsides. His clean-lipped mouth was
a slit no wider than the opening of his hip pocket. Yet he was not an
unsympathetic man, as his mild brown eyes betrayed.
"Well, friends, we are gathered here on an occasion that I had
hoped might be put off for a score of years yet. But Cap'n Jethro broke
up fast during the past year, as such men as he often do. When their
old hulks strike the rocks of age they go to pieces quickly.
"But Cap'n Jethro took time by the forelock and made all his
property arrangements in good season. He converted everything into
cash—even to the house he lived in to the last—and to settle his estate
is going to be a very easy matter.
"Are we all here?" proceeded Judge Waddams, looking slowly
about the room. His gaze fastened upon Tobias. "I don't see your sister,
Miss Heppy, Mr. Bassett?"
"You'll have to look twice at me, then, Judge," chuckled the
lightkeeper. "She couldn't make it to come, nohow."
Judge Waddams gravely nodded, unlocked a drawer in his table,
and drew forth a folded document of portentous appearance. There
was considerable stiffening in the chairs and a general clearing of
throats. The Judge adjusted his eyeglasses.
"Captain Jethro Potts entrusted me with the drawing of this will,
and it was sealed in my presence, and in that of two witnesses who
have absolutely no interest in the provisions of the instrument," he said
officially. "I will now read it."
The introduction and opening paragraphs held the breathless
attention of his audience. There followed itemized gifts of personal
property, such as the ancient furnishings of Captain Potts's little home—
keepsakes that might or might not satisfy a sentimental feeling in the
hearts of the recipients.
Icivilla Potts preened herself over the fact that the walnut highboy
which had been the chief piece of furniture in Captain Jethro's parlor
had been left to her by the maker of the will. Then:

"'Item: One certain two-gallon jug containing Jamaica rum, to my


mother's second cousin, Isaac Bassett—that remaining portion as he
shall not have already drunk at the unsealing of this instrument.'"

"Heh? By mighty! An' I drunk the last drop o' that rum just before we
took him to the church to-day," exploded Isaac, more in sorrow than in
anger. "Wal, I always did say that you couldn't get the best of Cap'n
Jethro Potts, dead or alive—an' this proves it!"
"Sarves ye right," declared Mrs. Andrew Dawson, as the lawyer
frowned down Isaac's interruption.
All those present—and some others—had been named for legacies
of personal property, saving Tobias. The other relatives of the dead
man began to gaze curiously upon the lightkeeper as the list was
concluded—Icivilla with scorn.
The lawyer read gravely the next partition of the will. It was to the
effect that the testator, having seen clearly that his relatives
hereinbefore named were covetous of his money, and would little
consider the sentimental value of the above legacies, bequeathed to
each person the sum of one dollar to be paid out of his estate by the
administrator, Edward Waddams.
This stunning statement smote dumb every listener save Isaac
Bassett. He burst into a raucous "Haw! haw!" and slapped his knee as
he weaved back and forth in his chair.
"By mighty!" he exploded, "I ain't the only one old Jethro fooled.
Haw! Haw!"
The high squeal of Andrew Dawson, who occasionally asserted
himself in spite of his wife, rose above the general murmur of
disappointment and anger:
"I wanter know, then, what's to become of all Jethro's money! I
wanter know that!"
"If you folks will keep quiet long enough for me to do so, I will
read the remainder of the instrument," Judge Waddams said sharply.
They subsided. But there were few but red and wrathful faces in
the company. Icivilla Potts was almost bursting with rage. Judge
Waddams continued.
The residue of the estate, which would amount, after all bills were
settled and fees paid, to about six thousand dollars, was to be divided
equally between Hephzibah Bassett and Tobias Bassett, of Twin Rocks
Light, the two relatives of all Captain Jethro Potts's clan, as the will
stated, who had never made him feel that they were covetous of his
money or wished him out of the way that they might get it.
"Oh, sugar!" murmured Tobias, actually disturbed. "Too bad Cap'n
Jethro felt that way about it. I don't believe all of them wished him
dead."
Judge Waddams looked scornfully over the company now
expressing to each other in no unmistakable terms their
disappointment and chagrin, and observed to the lightkeeper:
"There's a-many people's feet feel that itch for dead men's shoes,
Tobias. I'm glad you and Miss Heppy were favored by Cap'n Jethro. I
know of none of his family more deserving."
"Oh, sugar!" rejoined the lightkeeper, "I cal'late Cap'n Jethro didn't
much consider me and Heppy's deserts. It was to satisfy his own
grudge ag'in 'em that he done this. Still, we are as near to him in blood
as ary one of the others. And we didn't never cal'late on getting his
money, though I'm frank to say we hoped he'd give us some if he died
first.
"Wal, Judge, when you want Heppy and me to sign papers we'll
meet you at the Clinkerport Bank. This ain't no place for me just now.
Icivilly could purt' near tear me apart. I am going to escape while the
escapin' is good," Tobias concluded, chuckling.
He could not play the hypocrite by commiserating with the
disappointed crowd. Nor did he wish any of them to congratulate him
when their hearts were not at all attuned to such feeling.
"Least said, soonest mended," Tobias secretly observed. "Give 'em
time to trim their sails. But won't Heppy be purt' near surprised to
death over this? Oh, sugar!"
He was in no mood to discuss the surprising outcome of the
funeral of Captain Jethro Potts, even to the curious Clinkerport folks
who knew of the reason for his trip down the coast, and who saw him
alight from the up train that afternoon.
"Wal, how'd ye make out, Tobias?" asked Ben Durgin, the
Clinkerport station agent.
"Purt' tollerble," responded the lightkeeper cheerfully. "Though my
feet do ache some in these shoes."
"Did your Uncle Jethro leave much, Tobe?" asked a bolder spirit.
"Wal, as the feller said, he left the earth," chuckled Tobias.
"I say!" exclaimed Ezra Crouch, whose bump of inquisitiveness
could only be equaled by Amos Pickering, the mail carrier's, "didn't they
read the will, Tobias?"
"Oh, sugar! Yes. So they did," agreed the lightkeeper.
"Wal, then, who's to get his money?"
"Why—there wasn't nobody forgotten," Tobias assured him. "No,
sir, not a soul! There ain't no rel'tive of Cap'n Jethro' that can honestly
say he or she was forgotten in the will."
Nor was he more communicative when he chanced to meet Ralph
Endicott getting out of his roadster in front of the Clinkerport Inn.
"Wal, young feller!" exclaimed the lightkeeper, "what brings you
over here from Amperly? Ain't got your lady friend with ye, eh?"
"If you mean Lorna, I have not. She has gone to New York on a
visit, I understand. But Uncle Henry made me come over here and
arrange for one of Tadman's bungalows. He won't hear to our going
anywhere else for the summer."
"Which don't please you none, I can see," commented Tobias.
"Which one of them bungalows are you going to have?"
"I had to take the one right next to the Nicholet house," said the
disgruntled young man. "That was the only one left—it is so late in the
renting season. I was hoping to get Uncle Henry to agree to a change
for one summer, at least. But nothing doing!"
"I see," observed Tobias, grinning privately.
"Uncle Henry is all wrapped up in a new invention. He wants to be
where it is quiet. The goodness knows it's quiet enough at Clay Head."
"I cal'late. Come over to the light, Ralphie, and have a mess of
Heppy's fishballs."
"Well, I might drive you home just as well as not," the young
fellow agreed, smiling.
"You're a re'l bright boy, Ralphie, even if you can't appreciate Lorny
Nicholet."
"Now, stop that, Tobias Bassett!" exclaimed his young friend,
exasperated, "or I'll surely overturn you in the ditch," and he threw in
his clutch with a vicious jerk as the engine began to purr.

CHAPTER VII
A NEWCOMER

Tobias postponed the telling of the wonderful news to Miss Heppy until
after supper and after Ralph Endicott had wheeled away from the Twin
Rocks Light in his car. She had crowded down the question until then;
but it finally came out with a pop.
"Who did Uncle Jethro leave his money to, Tobias?" she
demanded, as he turned away from closing the door.
"To me an' you, Heppy—pretty near every last cent of it."
"Now, stop your funnin'!"
"Ain't funning. It is the truth," her brother said. "Six thousand
dollars, nearabout. And if you'd seen Icivilly Potts's face!" he chuckled.
"For love's sake!" gasped Miss Heppy. "It can't be!"
"It can be, for it is."
"Why, Tobias, we're rich!"
"I cal'late."
"I—I never would have believed it!" exclaimed his sister, and
sinking into her chair she threw her apron over her head and began to
sob aloud.
"Oh, sugar! what you cryin' for?" Tobias demanded. "'Cause Icivilly
and them others didn't get Uncle Jethro's money? Have some sense,
do! This ain't no time for weeping. Just think of what you can do with
three thousand dollars."
"You just said six thousand!" ejaculated Miss Heppy, hastily
reappearing above the hem of her apron. "Where's half of it gone?"
"Oh, you're to get half and me half. What you going to do with
your three thousand, Heppy?"
"Just what you will do with yours, Tobias Bassett!" she exclaimed.
"Put it into the Clinkerport Bank to our joint account. We got 'most two
thousand there now. We'll have eight thousand against the time when
we can't work no more and will need it."
"Oh, sugar!" muttered her brother. "I might ha' knowed it. Your
idea of a pleasure spree always was going to the bank to make another
ten dollar deposit."
"Now, Tobias," she said with gravity, "don't you let no foolish,
spendthrift idees get a holt on your mind. I won't hear to 'em. You
never would have had a penny in the bank if it hadn't been for me."
"That's the truth," sighed Tobias. "You got me so that every time a
quarter comes my way the dove of peace on it screams for mercy.
Yessir! I'm getting to be a reg'lar miser, 'long o' you, Heppy."
The lightkeeper and his sister fully understood and appreciated
each other's virtues. That Tobias was generous to a fault and that
Hephzibah's saving disposition had long since warded him from
financial wreck, they both were well aware. Tobias publicly scorned,
however, to acknowledge this latter fact.
"I certainly shall hate to see you turn the key on every dollar of
that money, Heppy," he complained, preparing to mount to the lamp to
see that all was right up there. "We ain't never cut a dash in our lives. I
certainly should like to make a splurge for once."
"You'd fly right in the face of Providence if I wasn't here to hold
you back," declared his sister. "Experience can't teach you nothing."
"Oh, sugar! I know I've always spent my paycheck like ducks and
drakes," he chuckled. "Wal, leave it to you, Heppy, and Uncle Jethro's
money won't get much exercise, for a fact."
When he came down from the lamp he announced a change in the
weather. The wind began to whine around the tall staff and rain squalls
drifted across the sullenly heaving sea outside the Twin Rocks. The
night dissolved into a windy and tumultuous morning, and the fishing
fleet remained inside the capes.
Tobias went aloft after breakfast to clean and fill the lamp before
taking his usual morning nap. To the eastward rode a dun-colored
object that at first could scarcely be made out, even by his keen eyes.
"It's a craft of some kind—sure is!" he muttered. "But whether it's
turned bottom up, or is one o' them there motor-boats, decked over
for'ard and without no mast—Hi! There's a mast of a kind, and with a
pennant to it, or something. Mebbe 'tis the feller's shirt."
That the motor craft was in some trouble the lightkeeper was
confident. The heavy seas buffeted it without mercy. He saw that the
master of the craft could not keep steerageway upon it.
"He'll be swamped, first thing he knows," muttered the anxious
lightkeeper. "Yep! he's put up some kind of a flag for help. But, sugar!
nobody won't see him from inside the harbor—an' there ain't another
livin' craft upon the sea."
Tobias hurried down from the lamp gallery. The cove between the
light and the Clay Head was empty of all craft so early in the season. In
fact, the only boats in sight were his own sloop, still high and dry upon
the sands at the base of the lighthouse, and the heavy dory from which
he trolled for rock-fish as he chanced to have time on the outer edge of
the reefs.
He flung a word to Heppy, and she ran out and helped him launch
the dory.
"You have a care, Tobias," she cried after him as he settled the
oars between the thole-pins. "Remember you ain't so young as you
used to be."
"Oh, sugar!" he returned, "I ain't likely to forget it as long as your
tongue can wag, Heppy."
The heaving gray waves roared over the rocks in great bursts of
foam. The tiny, sheltered bight between the reefs had offered a more
or less quiet launching for the dory, but the lightkeeper was soon in the
midst of flying spume, his craft tossed and buffeted by the broken
water that eddied off the points of the reef.
He drove clear of this in a few moments and pushed out to sea.
Rising on a "seventh wave"—a particularly big one—Tobias glanced
over his shoulder. The wallowing motor-boat was still right side up.
There seemed to be but one person in it. The pennant whipped from
the short staff in the stern where the figure of the man was likewise to
be distinguished.
"She's broken down complete," muttered the old lightkeeper, "and
he's keeping her head to it with an oar."
He settled himself for the long and arduous pull before him. In his
youth he had many times managed a dory—sometimes laden with fish
from the trawl-lines—in a worse sea than this. Tough in fibre as the ash
oar he drove, was Tobias Bassett. He did not overlook the possible peril
in this trip to the unmanageable motor-boat, but he had taken just
such chances often and again.
Spoondrift, dashed from the caps of the waves, drenched him.
When he turned his head now and again to make sure of his course,
this spray spat viciously in his face. Little whirlwinds swooped down
upon the sea and turned certain areas of it into boiling cauldrons of
yellow foam.
"Looks like a caliker cat in a fit," was Tobias's comment on one
occasion.
But these squalls were for the most part ignored by the
lightkeeper. They were unpleasant visitations, but he knew the dory
could weather them.
He pushed on unfalteringly. Glancing from time to time over his
shoulder, Tobias saw that the occupant of the stalled motor-boat had
sunk down in her cockpit. He seemed to have lost his steering oar, and
the craft was being tossed whithersoever the sea would.
"The poor fish!" growled Tobias. "He's likely to find a watery grave
after all. Must be something the matter with him."
As the dory drew nearer the lightkeeper saw a pallid face staring
at him over the gunnel of the motor-boat. The boat had shipped
considerable water and was wallowing deep in the sea; but the man
seemed unable even to bail out.
"Crippled—must be," decided the rescuer, at last. "I'd better get to
him soon, or he'll lose all holts."
Despite the boisterous seas the lightkeeper brought his dory
skilfully alongside the tossing motor-boat. The wan face of the young
fellow in it advertised his woe.
"What's the matter with ye?" bawled Tobias.
"I've hurt my foot!" replied the man. "I guess I've sprained it."
"Oh, sugar! That might ha' kept ye from walking ashore. But
what's the matter with your boat?"
"The engine won't run, and the steering-gear is fouled. I haven't
been able to do a thing with it since daybreak."
"Hard luck!" returned Tobias. "Better come aboard here. Can ye
make it alone?"
"Can't you tow me? I don't want to lose my boat. It cost a lot of
money."
"Likely. But I ain't no sea-going towboat," said the lightkeeper. "If I
undertook to try to tow your boat, we'd bring up about to the
Bahamas. You'll have to kiss it good-bye, I cal'late."
"I'll pay you well," cried the other.
"Can't be did," said Tobias confidently. "Now, then, when I throw
her to ye, be ready to crawl over the gunnels. We ain't got no time to
jabber. Stand by!"
Seeing that the old man was firm in his intention, the castaway
prepared awkwardly to make the exchange. He was doused between
the two boats, but Tobias Bassett's strong hand helped him inboard, or
a tragedy might have been enacted. The castaway was a man in the
early twenties, and not at all robust looking. Nor did his countenance
very favorably impress the rescuer.
"Still, ye can't scurcely judge the good points of a drowned rat,"
Tobias considered, as the man he had rescued squatted in the stern of
the dory, nursing his right foot and groaning.
"Tell me all about it," the rescuer suggested. "How did it happen?"
"I left Nantucket yesterday noon, going to Boston."
"All the weather-wise folks on Nantucket must be dead, eh? Or
didn't nobody tell ye to take the inside passage?"
"Well, I thought I could make it outside before it blew really hard.
And I could have done so, only for that engine."
"I see."
"Then I fell and twisted my foot. It's swollen, you see. Can't put
my weight on it."
"Too bad," grunted the lightkeeper between strokes. "And you
been battin' off and on here all night?"
"Pretty near."
"Lucky I spied ye. It's going to blow harder before it gets through.
You didn't stand much chance of being picked up by any other craft, so
far inshore."
"I hate to lose my boat," complained the castaway.
"You like to have lost your life, young feller," said Tobias, seriously.
"You can get another motorboat easier. What's your name?"
"Conway Degger. I belong in Boston."
"Do ye, now? Come o' rich folks, I cal'late?"
"Not rich enough to throw away a motor-boat like that."
"Oh, sugar! I s'pose not. If the wind shifts she may come ashore."
"She'll be smashed up."
"Mebbe not past mending," said Tobias, trying to be comforting.
"Anyhow, you be glad, young feller, that ye got out of it as slick as ye
did."
"I don't want you to think I'm ungrateful," groaned Degger,
caressing his bruised foot. "But motor-boats don't grow on bushes."
"Never thought they did. Or I should try if one o' them bushes
would grow in Heppy's garden," chuckled the lightkeeper.
It was a long and hard pull to make the lighthouse landing. It was
near noon, and Tobias had rowed steadily for four hours, when the
dory grounded upon the sands with the surf roaring over the reefs
between which he had skilfully steered.
"Wal, we made it, didn't we?" sighed the lightkeeper, with a
measure of sarcasm quite lost upon Mr. Degger. "One spell I didn't
know as we would—you bein' crippled and helpless like you be."
"I am a thousand times obliged to you, Skipper," said Degger, quite
warmly, as he cautiously stood on one foot like a sandhill crane. "I
don't know how to thank you."
"No, I see ye don't," observed Tobias. "But ne'er mind. I got an
attic full of 'thank-yous.' Don't try to give me no more. Come up to the
light and have dinner. I smell fish chowder, and I do think my Sister
Heppy can make fish chowder 'bout right."
Conway Degger evidently agreed with the lightkeeper regarding
Miss Heppy's cooking. After Tobias had aided the cripple to hop up the
strand and to the light, and had introduced him to Miss Heppy, Degger
proceeded to make himself quite at home. Miss Heppy plodded up the
spiral stairway to the lamp room after dinner to consult with her
brother.
"He wants I should take him to board for a spell," she said. "He
seems a civil spoken sort of boy. I s'pose we could put him in the spare
room, now that you've finally got new winder-sashes for it."
"Wal, I s'pose you could."
"He wants to stay till his foot gets better. It's as black as your hat.
I been bandaging it."
"Did he want a bandage put on his pocketbook, too?"
"Now, Tobias! He's going to pay me four dollars."
"For the bandage?"
"A week. For his board."
"That's mighty good——"
"Why——"
"For him," finished the lightkeeper. "But it's your business, Heppy,
not mine. Seein's we are only going to have 'bout eight thousand
dollars in the bank, I presume you'd better take boarders to help out."
"Now, Tobias Bassett! it behooves us to make money while we
may. We ain't gettin' any younger."
"I agree with you," said her brother. "And I don't believe we'll be
wickedly overburdened with all the money you make out of this Degger
feller."
For Tobias had judged fairly accurately that young man's
idiosyncrasies. There was nothing of the spendthrift about Mr. Conway
Degger.

CHAPTER VIII
PHILOSOPHY AND OTHER THINGS

Tobias Bassett was a social soul and the "boarder," as he insisted upon
calling the young man he had rescued from the motor-boat, was not
tongue-tied. Get Degger set on a course, as Tobias termed it, relating
to his own exploits, and the young fellow became more than voluble.
The lightkeeper and Miss Heppy certainly were surprised to learn
that their visitor was acquainted with the Nicholets.
"You don't mean to tell me that that is the Nicholets' summer
home up on that bluff? That first one yonder?" said the young man.
"That's it," replied Tobias, sitting on the bench beside the
lighthouse door to smoke an after-supper pipe. "I see the storm
shutters are down. They'll be coming soon, I cal'late."
"And Miss Lorna comes here every summer? A charming girl."
Tobias looked at him fixedly.
"I don't suppose you'd be knowing Ralph Endicott? The Endicotts
will occupy the house next to the Nicholets."
"The Endicotts of Amperly?"
"Them's the ones. Ralph is the one I mean. Feller 'bout your age,
mebbe."
"If it is the Ralph Endicott I know," said Degger, the expression of
his face changing, "he and I were at Harvard together."
"You don't say!" Tobias's eyes twinkled. The reason for the familiar
sound of the boarder's name was suddenly explained. This was the
"Conny Degger" Ralph had spoken of, for whose society Lorna had
once shown a penchant. "I cal'late you know Ralph pretty well, then?"
insinuated the lightkeeper.
"Oh, I was never chummy with Ralph Endicott," Degger observed.
"He and I were scarcely in the same set." Which was strictly true.
Nobody could doubt it. Then he verged on rather thin ice: "You see,
Ralph's kind are high-flyers." He dropped his voice a notch and glanced
around to make sure that Miss Heppy was not within hearing. "Fellows
like Ralph Endicott don't go to college altogether to study."
"I give it as my opinion," admitted Tobias, placidly smoking, "that
some of 'em go mostly to learn about the breeds o' bulldogs—both
pipes and canine. And they study how to play cards, and to dress as
fancy as a nigger minstrel. I've seen some of that kind. But Ralph——"
"No. He did not run to those foibles, I believe. But there was a girl
—well, you know how it is with some fellows, Skipper. Every pretty face
attracts them, and there are plenty of girls of light ideas in every
college town. Cambridge is no exception."
"Oh, sugar!" ejaculated the lightkeeper. "I wouldn't think it of
Ralph."
"Sly boy!" chuckled Conny Degger grinning. "Guess his folks never
knew much about it. They are straight-laced, I fancy. But he was seen
a good deal with Cora Devine—and she was not all she should be."
"Oh, sugar!" exclaimed Tobias again. "Maybe 'twas only a boy and
girl flirtation."
"She was no innocent kid. Believe me, Skipper, that Devine girl
knew her way about. Why, I was told she'd been trooping with a
burlesque show. Ralph Endicott made a perfect jack of himself over her.
It was even rumored that they ran off and were married once when he
was half-stewed."
Tobias jumped on the bench and uttered a startled exclamation.
"What is the matter, Skipper?"
"Must o' been one of them pesky sandfleas," muttered the
lightkeeper. "Wal, go on with your tale o' crime."
"Ha! Ha! No crime about it. Just Endicott's foolishness. If he did
marry her, I'm sorry for him. She'll be bobbing up to confront him later.
Such girls always do. They are expensive trimmings to a fellow's
college career."
"I cal'late," agreed Tobias, more calmly.
But later he sounded Heppy on a topic which he had not touched
upon since back in the late winter when Lorna and Ralph had been
stormbound at the light.
"Didn't Lorny say something to you about Ralph paying 'tentions to
some gal at college? Wasn't she some worked up about it?"
"For love's sake, Tobias, she never spoke as though she'd feel
jealous any if Ralph Endicott had forty girls! I should say not! She did
mention that Ralph had some love affair when he was at school. But
she called it puppy love," concluded Miss Heppy, with a sniff.
"Humph! Sort o' scorned it, did she? It didn't seem to worry her
none?"
"Worry her? I should say not! But I guess 'twas only gossip at that.
I don't believe Ralph Endicott is the sort of a boy to play fast and loose
with any girl."
"Does seem as though we feel about alike on that score, Heppy,"
reflected her brother. "Ralph, it strikes me, is purt' sound timber. But I
wonder, now, where Lorna Nicholet got her information about Ralph's
chasing around after that chorus gal? Does seem as though such a
story might be one o' the things that makes Lorna so determined to cut
Ralph adrift. Oh, sugar!"
But these final reflections of the lightkeeper were inaudible. He
had by no means lost interest in his matchmaking intrigue regarding
the two young people who he was convinced were "jest about made
for each other."
His scheme—if scheme he had—had been in abeyance all these
weeks. Now that the families of the young people were about to take
up their residence on the Clay Head, he proposed to enter upon a more
active campaign for what he believed to be the happiness of all
concerned.
Not alone was Miss Heppy aware of the long-past bond of affection
between Miss Ida Nicholet and Ralph's Uncle Henry. Tobias Bassett had
been just as observant as his sister—or anybody else.
Like others, he had wondered twenty years before why the then
young Professor Endicott had not pursued with more vigor the
charming, if independent, Ida Nicholet, and made her his bride. There
was a romance nipped in the bud which Tobias always felt he might
have mended—"if he'd put his mind to it."
In any case he determined not to see the ship of Ralph and
Lorna's happiness cast on the rocks if he could help it. He felt that it
might be within his power to avert such disaster. The strategic yeast of
the true matchmaker began to stir within him.
"Miss Ida," as everybody called Lorna's assertive aunt, could not
be long in any place without making her presence felt. Her original and
independent character never failed to make its impress upon all
domestic, as well as other, affairs. The Nicholet ménage was run like
clockwork. Miss Ida was the clock. Everything at the big house on Clay
Head was soon working smoothly, and Miss Ida could look about.
She was a tall, free-striding, graceful woman without a gray thread
in her abundant dark hair. She piled that hair low at the back of her
head, and her neck and throat were like milk, and flawless.
When she came across the barrens under her rose-tinted parasol
to see Miss Heppy at the Light, her plain morning dress was arranged
as carefully as a ball gown would be on another woman. In addition,
her pleasant eyes and round, firm chin, together with her Junoesque
figure, made her appearance most attractive.
"Well, Heppy, how do you do?" she asked, her voice mellow and
full. "How has the winter gone with you?"
"'Bout the same as usual, Miss Ida," the lightkeeper's sister replied.
"You be a pretty sight. None o' the young ones can put anything over
you, Miss Ida. You ain't got a wrinkle or a fleck of gray in your head."
Miss Ida laughed. "I'm forty-two. I'm frank to admit it. Why
shouldn't a woman be well preserved and in good health at my age if
she has never made herself a slave to some man?"
"For love's sake! As for that, I ain't never been married. But look at
my wrinkles!"
"Those are creases, not wrinkles, in your case, Heppy," laughed
the visitor. "You are getting too fat. And you have been practically a
slave for Tobias."
"Sure she has," agreed the lightkeeper grinning. "I've been
thinking of putting a nose-ring on her. She's abused, all right."
"You hush, Tobias! I ain't slaved for nobody but him, Miss Ida,"
declared Hephzibah warmly. "While you, Miss Ida, have shouldered the
responsibility for your brother and all his family. If you'd married,"
added the longshore woman wisely, "like enough you wouldn't have
had nowhere near so big a family to care for."
"I wonder?" laughed the other woman. Yet her expressive
countenance became immediately serious. "My family is pretty well
grown now, Heppy. I am sure even Lorna is old enough to make a nest
for herself. She has been out two years."
"Out o' what?" Tobias asked, taking the pipe from his mouth and
staring. "Looks to me as though she was well supplied with most
everything a young gal ought to have, an' wasn't out o' nothing."
"I mean she has been in society two years."
"Oh, sugar! That's a case, is it, of when you're out, you're in?"
chuckled the lightkeeper. "I give it as my opinion that the only thing
Lorny lacks is a good husband."
Miss Ida flushed softly. "I hope she will see the advisability of
choosing wisely in that matter," the aunt said, speaking intimately to
these two old friends, at the expression of whose interest in her family
affairs she was far too sensible to take offence.
"Yes," she pursued. "You know what hopes her father and I have
for her. An eminently fitting alliance. And Ralph is a manly fellow. It
does seem as though those two were quite made for each other."
"Humph! Yes. 'Twould seem so," muttered Tobias. "But it does
appear sometimes as though the very things that ought to be don't
somehow come around to happen."
"You are a philosopher, Tobias."
"Dunno as that's a compliment, Miss Ida," rejoined the lightkeeper,
his eyes twinkling. "I got all my wits about me yet, and most of them
philosophers you hear tell about ain't. They get on some hobby and
ride it to death. And a man ain't really broad-minded unless he can see
both sides to a question.
"Now, takin' the chances for and against your Lorna and Ralph
Endicott marryin'. What would you say, Miss Ida, was the one best
bet?"
He looked up at her shrewdly, holding his pipe with that familiar
gesture of his. Miss Ida's gravity grew more profound.
"I believe you and Heppy must know that of late my niece and
Ralph have seemed to fret one another?" she queried.
"They give themselves away some when they stopped over here
that time they got stalled in Ralph's car," admitted Tobias. "Warn't it
jest a leetle spat?"
"I am afraid not. They have not seemed the same since. And I am
afraid it is Lorna's fault," sighed Miss Ida. "She is so hot-tempered. I
have warned her. The families have never considered any other
possible outcome but an alliance between Lorna and Ralph. I have told
her so."
"I cal'late you have," murmured Tobias softly, pulling on his pipe
again.
"When she returns from New York—as she will in a day or two—I
shall put the matter to her very strongly. If you and Heppy have
noticed their drifting asunder, other people must have noticed it too.
The Nicholets would be utterly disgraced if it were said that Ralph
Endicott—er—dropped Lorna. And if he should, I fear it will be my
niece's own fault."
When she was gone Tobias snorted suddenly.
"Oh, sugar!" he said. "If I scorch 'em a mite graced, I want to
know, when Miss Ida's love affair with Professor Endicott busted up?
Seems to me that leetle gal, Lorny, is going to be put upon by her
folks. That won't do."
"Now, do try to mind your own business, Tobias," advised his
sister, comfortably rocking. "I know it will be hard for you to do so. But
you'll burn your fingers, like enough, if you don't."
The lightkeeper spread out his gnarled, work-blunted fingers to
observe them reflectively.
"Oh, sugar!" he said. "If I scorch 'em a mite helping that leetle gal
and Ralph Endicott out o' their muss, what's the odds, Heppy? You
know, we're put here to help each other."
"That is what most folks say that have an itch for minding other
people's business. Now, you have a care what you do, Tobias Bassett."
CHAPTER IX
THE DROP OF WORMWOOD

When Lorna Nicholet first appeared at the Twin Rocks Light after
arriving at her summer home, she gave no evidence of needing the
lightkeeper's—or any other person's—good offices. She was her
usual brisk, contented and fun-loving self.
Conway Degger chanced to be present when Lorna came to the
Light. Miss Ida had not seen the young man when she had called on
Tobias and Heppy.
"What a surprise, Mr. Degger!" the girl said, giving him a warmly
welcoming hand. "I had no idea you were in this locality."
"I am a waif from the sea, Miss Nicholet," he told her. "You ask
the skipper, here, about it. I can never thank him enough. And Miss
Heppy, too, who has so kindly taken me in and ministered to my
well-being."
"He says it pretty, don't he now?" whispered Miss Heppy to
Tobias.
"Pretty is as pretty does," muttered the lightkeeper. "Somehow
them fanciful speeches of his'n don't bait much trawl with me."
But Miss Heppy considered Conny Degger quite worthy of
approval. Lorna found him interesting, too. Perhaps the very fact
that her Aunt Ida had opposed her acquaintance with the young
man caused Lorna to be the more contrary. And, really, Degger
betrayed some rather attractive traits.
During the next few days the girl and the boarder at Twin Rocks
Light became close companions. They went fishing together in
Tobias's dory. They tramped the beach as far as the Lower Trillion
life-saving station, Degger's sprained foot being quite well again.
And the young man appeared regularly on the Clay Head bathing
beach at the morning bathing hour.
Among the few families already at the resort, who made up a
little social world of their own, it soon became a topic of
conversation—this companionship of Lorna Nicholet and Conny
Degger. Particularly was it commented upon, because for so many
summers the girl and Ralph Endicott had been such close chums.
Although the Endicotts had already arrived at the Clay Head,
Ralph did not at once put in an appearance. This fact perhaps threw
Lorna the more into Conny Degger's company. Tongues began to
wag.
"I should say," squeaked Amos Pickering, who was a very busy
man these days because of the influx of summer visitors, "that Lorny
Nicholet has got another feller. That long-laiged Endicott boy's
always been tagging her other summers. Now this here boarder you
got, Tobias, is stickin' to her like a barnacle. What d'ye think it'll
amount to?"
"I give it as my opinion," retorted the lightkeeper, pursing his
lips, "that it won't add none to your burdens, Amos. I don't see no
weddin' invitations in the offing for you to distribute."
"She's jest a-flirtin', is she?"
"Like a sandpiper," declared Tobias. "Keepin' her hand in as ye
might say. There ain't a mite o' harm in Lorny, but she's got to have
some amusement."
He was nevertheless glad to see Ralph arrive. The lightkeeper
believed that Lorna would much better have her old friend at hand
to compare Degger with.
Had he been present at the first meeting of the trio, Tobias
Bassett might have experienced some doubt of the value after all of
such comparison. Lorna greeted Ralph very coolly. She and Degger
were about to launch the lightkeeper's dory for a fishing trip when
Ralph came striding down from the Clay Head.
"'Lo, Ralph," was the girl's careless hail. "Did you put the bait-
pail in, Mr. Degger?"
"All right, Miss Lorna. It's right here. How do, Endicott?"
"I heard you were here, Degger," said Ralph, merely nodding to
Lorna. "What's running now?"
"Mostly squeteague and fluke," replied the girl. "Occasionally a
tautog on rocky bottom. No snappers yet."
"Nothing worthy of Your Majesty's prowess," gibed Degger. "I
understand you are a real fisherman," and he pushed off the boat.
Ralph's gaze narrowed and his brow clouded. He sat down on
the sand. There was room enough in the dory for a third; but neither
of them had suggested his joining them.
Perhaps Ralph's attitude was not exactly that of a dog in the
manger. But it did trouble him to see his erstwhile chum so friendly
with Conny Degger. Not that he knew of anything actually bad about
the fellow. Merely, he had seemed so inconsequential and, at times,
rather vulgar.
Ralph was quite aware that some men are one thing to their
masculine friends while they act entirely differently in the company
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like