483 lines
16 KiB
Plaintext
483 lines
16 KiB
Plaintext
<Chapter Id="intro">
|
|
<TITLE>Introduction</TITLE>
|
|
|
|
<Para>
|
|
This document is the user manual for the
|
|
<Ulink url="http://postgresql.org/"><ProductName>PostgreSQL</ProductName></Ulink>
|
|
database management system, originally developed at the University
|
|
of California at Berkeley. <ProductName>PostgreSQL</ProductName> is based on
|
|
<Ulink url="http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/postgres.html">
|
|
<ProductName>Postgres release 4.2</ProductName></Ulink>.
|
|
The <ProductName>Postgres</ProductName> project,
|
|
led by Professor Michael Stonebraker, has been sponsored by the
|
|
Defense Advanced Research Projects Agency (<Acronym>DARPA</Acronym>), the
|
|
Army Research Office (<Acronym>ARO</Acronym>), the National Science
|
|
Foundation (<Acronym>NSF</Acronym>), and ESL, Inc.
|
|
</Para>
|
|
|
|
<Sect1>
|
|
<Title> What is <ProductName>Postgres</ProductName>?</Title>
|
|
|
|
<Para>
|
|
Traditional relational database management systems
|
|
(DBMSs) support a data model consisting of a collection
|
|
of named relations, containing attributes of a specific
|
|
type. In current commercial systems, possible types
|
|
include floating point numbers, integers, character
|
|
strings, money, and dates. It is commonly recognized
|
|
that this model is inadequate for future data
|
|
processing applications.
|
|
The relational model successfully replaced previous
|
|
models in part because of its "Spartan simplicity".
|
|
However, as mentioned, this simplicity often makes the
|
|
implementation of certain applications very difficult.
|
|
<ProductName>Postgres</ProductName> offers substantial additional
|
|
power by incorporating the following four additional
|
|
basic concepts in such a way that users can easily
|
|
extend the system:
|
|
|
|
<SimpleList>
|
|
<Member>classes</Member>
|
|
<Member>inheritance</Member>
|
|
<Member>types</Member>
|
|
<Member>functions</Member>
|
|
</SimpleList>
|
|
</Para>
|
|
|
|
<Para>
|
|
Other features provide additional power and flexibility:
|
|
|
|
<SimpleList>
|
|
<Member>constraints</Member>
|
|
<Member>triggers</Member>
|
|
<Member>rules</Member>
|
|
<Member>transaction integrity</Member>
|
|
</SimpleList>
|
|
</Para>
|
|
|
|
<Para>
|
|
These features put <ProductName>Postgres</ProductName> into the category of databases
|
|
referred to as <FirstTerm>object-relational</FirstTerm>. Note that this is distinct
|
|
from those referred to as <FirstTerm>object-oriented</FirstTerm>, which in general
|
|
are not as well suited to supporting the traditional relational database languages.
|
|
So, although <ProductName>Postgres</ProductName> has some object-oriented features,
|
|
it is firmly in the relational database world. In fact, some commercial databases
|
|
have recently incorporated features pioneered by <ProductName>Postgres</ProductName>.
|
|
|
|
</Sect1>
|
|
|
|
<Sect1>
|
|
<Title>A Short History of <ProductName>Postgres</ProductName></Title>
|
|
|
|
<Sect2>
|
|
<Title>The Berkeley <ProductName>Postgres</ProductName> Project</Title>
|
|
|
|
<Para>
|
|
Implementation of the <ProductName>Postgres</ProductName> <Acronym>DBMS</Acronym> began in 1986. The
|
|
initial concepts for the system were presented in
|
|
<!--
|
|
<XRef LinkEnd="STON86">
|
|
-->
|
|
<Citation>[STON86]</Citation>
|
|
and the definition of the initial data model
|
|
appeared in
|
|
<!--
|
|
<XRef LinkEnd="ROWE87">.
|
|
-->
|
|
<Citation>[ROWE87]</Citation>.
|
|
The design of the rule system at
|
|
that time was described in
|
|
<!--
|
|
<XRef LinkEnd="STON87a">.
|
|
-->
|
|
<Citation>[STON87a]</Citation>.
|
|
The rationale
|
|
and architecture of the storage manager were detailed in
|
|
<!--
|
|
<XRef LinkEnd="STON87b">.
|
|
-->
|
|
<Citation>[STON87b]</Citation>.
|
|
</Para>
|
|
|
|
<Para>
|
|
<ProductName>Postgres</ProductName> has undergone several major releases since
|
|
then. The first "demoware" system became operational
|
|
in 1987 and was shown at the 1988 <Acronym>ACM-SIGMOD</Acronym>
|
|
Conference. We released Version 1, described in
|
|
<!--
|
|
<XRef LinkEnd="STON90a">,
|
|
-->
|
|
<Citation>[STON90a]</Citation>,
|
|
to a few external users in June 1989. In response to a
|
|
critique of the first rule system
|
|
<!--
|
|
(<XRef LinkEnd="STON89">),
|
|
-->
|
|
(<Citation>[STON89]</Citation>),
|
|
the rule
|
|
system was redesigned
|
|
<!--
|
|
(<XRef LinkEnd="STON90b">)
|
|
-->
|
|
(<Citation>[STON90b]</Citation>)
|
|
and Version 2 was
|
|
released in June 1990 with the new rule system.
|
|
Version 3 appeared in 1991 and added support for multiple
|
|
storage managers, an improved query executor, and a
|
|
rewritten rewrite rule system. For the most part,
|
|
releases since then have focused on portability and
|
|
reliability.
|
|
</Para>
|
|
|
|
<Para>
|
|
<ProductName>Postgres</ProductName> has been used to implement many different
|
|
research and production applications. These include: a
|
|
financial data analysis system, a jet engine
|
|
performance monitoring package, an asteroid tracking
|
|
database, a medical information database, and several
|
|
geographic information systems. <ProductName>Postgres</ProductName> has also been
|
|
used as an educational tool at several universities.
|
|
Finally, <Ulink url="http://www.illustra.com/">Illustra Information Technologies</Ulink> picked up
|
|
the code and commercialized it.
|
|
<ProductName>Postgres</ProductName> became the primary data manager for the
|
|
<Ulink url="http://www.sdsc.edu/0/Parts_Collabs/S2K/s2k_home.html">Sequoia 2000</Ulink>
|
|
scientific computing project in late 1992.
|
|
Furthermore, the size of the external user community
|
|
nearly doubled during 1993. It became increasingly
|
|
obvious that maintenance of the prototype code and
|
|
support was taking up large amounts of time that should
|
|
have been devoted to database research. In an effort
|
|
to reduce this support burden, the project officially
|
|
ended with Version 4.2.
|
|
</Para>
|
|
</Sect2>
|
|
|
|
<Sect2>
|
|
<Title><ProductName>Postgres95</ProductName></Title>
|
|
|
|
<Para>
|
|
In 1994,
|
|
<ULink url="mailto:ayu@informix.com">Andrew Yu</ULink>
|
|
and
|
|
<ULink url="http://http.cs.berkeley.edu/~jolly/">Jolly Chen</ULink>
|
|
added a SQL language interpreter to <ProductName>Postgres</ProductName>, and the code was subsequently released to
|
|
the Web to find its own way in the world. <ProductName>Postgres95</ProductName> was a public-domain, open source descendant
|
|
of this original Berkeley code.
|
|
</Para>
|
|
|
|
<Para>
|
|
<ProductName>Postgres95</ProductName> is a derivative of the last official release
|
|
of <ProductName>Postgres</ProductName> (version 4.2). The code is now completely
|
|
ANSI C and the code size has been trimmed by 25%. There
|
|
are a lot of internal changes that improve performance
|
|
and code maintainability. <ProductName>Postgres95</ProductName> v1.0.x runs about 30-50%
|
|
faster on the Wisconsin Benchmark compared to v4.2.
|
|
Apart from bug fixes, these are the major enhancements:
|
|
|
|
<ItemizedList>
|
|
<ListItem>
|
|
<Para>
|
|
The query language <ProductName>Postquel</ProductName> has been replaced with
|
|
<Acronym>SQL</Acronym> (implemented in the server). We do not yet support
|
|
subqueries (which can be imitated with user defined
|
|
<Acronym>SQL</Acronym> functions). Aggregates have been
|
|
re-implemented. We also added support for ``GROUP BY''.
|
|
The <FileName>libpq</FileName> interface is still available for <Acronym>C</Acronym>
|
|
programs.
|
|
</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>
|
|
In addition to the monitor program, we provide a new
|
|
program (<Application>psql</Application>) which supports <Acronym>GNU</Acronym> <FileName>readline</FileName>.
|
|
</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>
|
|
We added a new front-end library, <FileName>libpgtcl</FileName>, that
|
|
supports <Acronym>Tcl</Acronym>-based clients. A sample shell,
|
|
pgtclsh, provides new Tcl commands to interface <Application>tcl</Application>
|
|
programs with the <ProductName>Postgres95</ProductName> backend.
|
|
</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>
|
|
The large object interface has been overhauled. We
|
|
kept Inversion large objects as the only mechanism
|
|
for storing large objects. (This is not to be
|
|
confused with the Inversion file system which has been
|
|
removed.)
|
|
</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>
|
|
The instance-level rule system has been removed.
|
|
Rules are still available as rewrite rules.
|
|
</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>
|
|
A short tutorial introducing regular <Acronym>SQL</Acronym> features as
|
|
well as those of ours is distributed with the source
|
|
code.
|
|
</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>
|
|
<Acronym>GNU</Acronym> make (instead of <Acronym>BSD</Acronym> make) is used for the
|
|
build. Also, <ProductName>Postgres95</ProductName> can be compiled with an
|
|
unpatched <ProductName>gcc</ProductName> (data alignment of doubles has been
|
|
fixed).
|
|
</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
</Para>
|
|
</Sect2>
|
|
|
|
<Sect2>
|
|
<Title><ProductName>PostgreSQL</ProductName></Title>
|
|
|
|
<Para>
|
|
By 1996, it became clear that the name <Quote>Postgres95</Quote> would not stand
|
|
the test of time. A new name, <ProductName>PostgreSQL</ProductName>, was chosen to reflect the
|
|
relationship between original <ProductName>Postgres</ProductName> and the more recent
|
|
versions with <Acronym>SQL</Acronym> capability. At the same time, the version numbering
|
|
was reset to start at 6.0, putting the numbers back into the sequence originally begun by
|
|
the <ProductName>Postgres</ProductName> Project.
|
|
|
|
<Para>
|
|
The emphasis on development for the v1.0.x releases of <ProductName>Postgres95</ProductName>
|
|
was on stabilizing the backend code.
|
|
With the v6.x series of <ProductName>PostgreSQL</ProductName>, the emphasis has shifted from
|
|
identifying and understanding existing problems in the backend to augmenting features and capabilities, although
|
|
work continues in all areas.
|
|
|
|
<Para>
|
|
Major enhancements include:
|
|
|
|
<ItemizedList>
|
|
<ListItem>
|
|
<Para>
|
|
Important backend features, including subselects, defaults, constraints, and triggers, have been implemented.
|
|
</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>
|
|
Additional <Acronym>SQL92</Acronym>-compliant language features have been added,
|
|
including primary keys, quoted identifiers, literal string type coersion, type casting,
|
|
and binary and hexadecimal integer input.
|
|
</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>
|
|
Built-in types have been improved, including new wide-range date/time types and additional geometric type support.
|
|
</Para>
|
|
</ListItem>
|
|
<ListItem>
|
|
<Para>
|
|
Overall backend code speed has been increased by approximately 20%, and backend startup time has decreased 80%.
|
|
</Para>
|
|
</ListItem>
|
|
</ItemizedList>
|
|
</Para>
|
|
</Sect2>
|
|
|
|
<Sect1>
|
|
<Title>About This Release</Title>
|
|
|
|
<Para>
|
|
From now on, We will use <ProductName>Postgres</ProductName> to mean <ProductName>PostgreSQL</ProductName>.
|
|
|
|
<Para>
|
|
<ProductName>PostgreSQL</ProductName> is available without cost. This manual
|
|
describes version 6.3 of <ProductName>PostgreSQL</ProductName>.
|
|
|
|
<Para>
|
|
Check the Administrator's Guide for a list of currently supported machines. In general,
|
|
<ProductName>PostgreSQL</ProductName> is portable to any Unix/Posix-compatible system
|
|
with full libc library support.
|
|
|
|
</Sect1>
|
|
|
|
<Sect1>
|
|
<Title>Resources</Title>
|
|
|
|
<Para>
|
|
This manual set is organized into several parts:
|
|
|
|
<VariableList>
|
|
<VarListEntry>
|
|
<Term>Tutorial</Term>
|
|
<ListItem>
|
|
<Para>
|
|
An introduction for new users. Does not cover advanced features.
|
|
</Para>
|
|
</ListItem>
|
|
</VarListEntry>
|
|
|
|
<VarListEntry>
|
|
<Term>User's Guide</Term>
|
|
<ListItem>
|
|
<Para>
|
|
General information for users, including available commands and data types.
|
|
</Para>
|
|
</ListItem>
|
|
</VarListEntry>
|
|
|
|
<VarListEntry>
|
|
<Term>Programmer's Guide</Term>
|
|
<ListItem>
|
|
<Para>
|
|
Advanced information for application programmers. Topics include
|
|
type and function extensibility, library interfaces, and application design issues.
|
|
</Para>
|
|
</ListItem>
|
|
</VarListEntry>
|
|
|
|
<VarListEntry>
|
|
<Term>Administrator's Guide</Term>
|
|
<ListItem>
|
|
<Para>
|
|
Installation and management information. List of supported machines.
|
|
</Para>
|
|
</ListItem>
|
|
</VarListEntry>
|
|
|
|
<VarListEntry>
|
|
<Term>Developer's Guide</Term>
|
|
<ListItem>
|
|
<Para>
|
|
Information for <ProductName>Postgres</ProductName> developers. This is intended
|
|
for those who are contributing to the <ProductName>Postgres</ProductName>
|
|
project; application development information should appear in the Programmer's Guide.
|
|
</Para>
|
|
</ListItem>
|
|
</VarListEntry>
|
|
|
|
<VarListEntry>
|
|
<Term>Reference Manual</Term>
|
|
<ListItem>
|
|
<Para>
|
|
Detailed reference information on command syntax.
|
|
At the moment, this manual is very sparse, but eventually should contain
|
|
information similar to that in the man pages.
|
|
</Para>
|
|
</ListItem>
|
|
</VarListEntry>
|
|
</VariableList>
|
|
|
|
<Para>
|
|
In addition to this manual set, there are other resources to help you with
|
|
<ProductName>Postgres</ProductName> installation and use:
|
|
|
|
<VariableList>
|
|
<VarListEntry>
|
|
<Term>man pages</Term>
|
|
<ListItem>
|
|
<Para>
|
|
The man pages have general information on command syntax.
|
|
</Para>
|
|
</ListItem>
|
|
</VarListEntry>
|
|
|
|
<VarListEntry>
|
|
<Term>FAQs</Term>
|
|
<ListItem>
|
|
<Para>
|
|
The Frequently Asked Questions (FAQ) documents address both general issues
|
|
and some platform-specific issues.
|
|
</Para>
|
|
</ListItem>
|
|
</VarListEntry>
|
|
|
|
<VarListEntry>
|
|
<Term>READMEs</Term>
|
|
<ListItem>
|
|
<Para>
|
|
README files are available for some contributed packages.
|
|
</Para>
|
|
</ListItem>
|
|
</VarListEntry>
|
|
|
|
<VarListEntry>
|
|
<Term>Web Site</Term>
|
|
<ListItem>
|
|
<Para>
|
|
The <ULink url="postgresql.org"><ProductName>Postgres</ProductName></ULink> web site has some information
|
|
not appearing in the distribution. There is a <ProductName>mhonarc</ProductName> catalog of mailing list traffic
|
|
which is a rich resource for many topics.
|
|
</Para>
|
|
</ListItem>
|
|
</VarListEntry>
|
|
|
|
<VarListEntry>
|
|
<Term>Mailing Lists</Term>
|
|
<ListItem>
|
|
<Para>
|
|
The <ULink url="mailto:questions@postgresql.org"><ProductName>Postgres</ProductName> Questions</ULink>
|
|
mailing list is a good place to have user questions answered. Other mailing lists are available; consult
|
|
the web page for details.
|
|
</Para>
|
|
</ListItem>
|
|
</VarListEntry>
|
|
|
|
<VarListEntry>
|
|
<Term>Yourself!</Term>
|
|
<ListItem>
|
|
<Para>
|
|
<ProductName>Postgres</ProductName> is an open source product. As such, it depends on the user community for
|
|
ongoing support. As you begin to use <ProductName>Postgres</ProductName>, you will rely on others
|
|
for help, either through the documentation or through the mailing lists. Consider contributing your
|
|
knowledge back. If you learn something which is not in the documentation, write it up and contribute it.
|
|
If you add features to the code, contribute it. Even those without a lot of experience can provide
|
|
corrections and minor changes in the documentation, and that is a good way to start.
|
|
The <ULink url="mailto:docs@postgresql.org"><ProductName>Postgres</ProductName> Documentation</ULink>
|
|
mailing list is the place to get going.
|
|
</Para>
|
|
</ListItem>
|
|
</VarListEntry>
|
|
</VariableList>
|
|
|
|
</Sect1>
|
|
|
|
<Sect1>
|
|
<Title>Copyrights and Trademarks</Title>
|
|
|
|
<Para>
|
|
<ProductName>PostgreSQL</ProductName> is copyright (C) 1996-8 by the PostgreSQL Global Development Group,
|
|
and is distributed under the terms of the Berkeley license.
|
|
|
|
<Para>
|
|
<ProductName>Postgres95</ProductName> is copyright (C) 1994-5 by the Regents of the University of California.
|
|
Permission to use, copy, modify, and distribute this software and its documentation
|
|
for any purpose, without fee, and without a written agreement is hereby granted,
|
|
provided that the above copyright notice and this paragraph and the following two
|
|
paragraphs appear in all copies.
|
|
</Para>
|
|
<Para>
|
|
In no event shall the University of California be liable to
|
|
any party for direct, indirect, special, incidental, or consequential
|
|
damages, including lost profits, arising out of the use of this
|
|
software and its documentation, even if the University of California
|
|
has been advised of the possibility of such damage.
|
|
</Para>
|
|
<Para>
|
|
The University of California specifically disclaims any
|
|
warranties, including, but not limited to, the implied warranties
|
|
of merchantability and fitness for a particular purpose.
|
|
The software provided hereunder is on an "as-is" basis, and
|
|
the University of California has no obligations to provide
|
|
maintainance, support, updates, enhancements, or modifications.
|
|
</Para>
|
|
|
|
<Para>
|
|
<Acronym>UNIX</Acronym> is a trademark of X/Open, Ltd. Sun4, SPARC, SunOS
|
|
and Solaris are trademarks of Sun Microsystems, Inc. DEC,
|
|
DECstation, Alpha AXP and ULTRIX are trademarks of Digital
|
|
Equipment Corp. PA-RISC and HP-UX are trademarks of
|
|
Hewlett-Packard Co. OSF/1 is a trademark of the Open
|
|
Software Foundation.
|
|
</Para>
|
|
|
|
</Chapter>
|