PostgreSQL

From Wikipedia, the free encyclopedia

PostgreSQL
PostgreSQL logo
Developed by PostgreSQL Global Development Group
Latest release 8.3.1 / March 18, 2008 (2008-03-18); 87 days ago[1]
Written in C
OS Cross-platform
Genre ORDBMS
License BSD license
Website http://www.postgresql.org/

PostgreSQL is an object-relational database management system (ORDBMS). It is released under a BSD-style license and is thus free software. As with many other open-source programs, PostgreSQL is not controlled by any single company, but relies on a global community of developers and companies to develop it.

Contents

[edit] Product name

The mixed-capitalization of the PostgreSQL name can confuse some people on first viewing. The several pronunciations of 'SQL' can lead to this confusion. PostgreSQL's developers pronounce it /poːst ɡɹɛs kjuː ɛl/; (Audio sample, 5.6k MP3). It is also common to hear it abbreviated as simply "postgres", which was its original name. Because of ubiquitous support for the SQL Standard amongst all relational databases, the community considered changing the name back to Postgres. However, the PostgreSQL Core Team announced in 2007 that the product would continue to be named PostgreSQL[2]. The name refers to the project's origins as a "post-Ingres" database, the original authors having also developed the Ingres database.

[edit] History

PostgreSQL evolved from the Ingres project at University of California, Berkeley. In 1982, the project leader, Michael Stonebraker, left Berkeley to commercialize Ingres. He returned to Berkeley in 1985 and started a post-Ingres project to address the problems with contemporary database systems that had become increasingly clear during the early 1980s. The new project, Postgres, aimed to add the fewest features needed to completely support types. These features included the ability to define types and to fully describe relationships – something used widely before but maintained entirely by the user. In Postgres, the database "understood" relationships, and could retrieve information in related tables in a natural way using rules. Postgres used many ideas of Ingres but not its code.

Starting in 1986, the team published a number of papers describing the basis of the system, and by 1988 had a prototype version. The team released version 1 to a small number of users in June 1989, then version 2 with a re-written rules system in June 1990. Version 3, released in 1991, again re-wrote the rules system, and added support for multiple storage managers and an improved query engine. By 1993 the great number of users began to overwhelm the project with requests for support and features. After releasing version 4 — primarily a cleanup — the project ended.

But open-source developers could obtain copies and develop the system further, because Berkeley had released Postgres under the BSD license. In 1994, Berkeley graduate students Andrew Yu and Jolly Chen replaced the Ingres-based QUEL query language interpreter with one for the SQL query language, creating Postgres95. The code was released on the web.

In July 1996, Marc Fournier at Hub.Org Networking Services provided the first non-university development server for the open source development effort. Along with Bruce Momjian and Vadim B. Mikheev, work began to stabilize the code inherited from Berkeley. The first open source version was released on August 1, 1996.

In 1996, the project was renamed to PostgreSQL to reflect its support for SQL. The first PostgreSQL release formed version 6.0 in January 1997. Since then, the software was maintained by a group of database developers and volunteers around the world, coordinating via the Internet.

Although the license allowed for the commercialization of Postgres, the code did not develop commercially at first — somewhat surprisingly considering the advantages Postgres offered. The main offshoot originated when Paula Hawthorn (an original Ingres team member who moved from Ingres) and Michael Stonebraker formed Illustra Information Technologies to commercialize Postgres.

In 2000, former Red Hat investors created the company Great Bridge to commercialize PostgreSQL and compete against commercial database vendors. Great Bridge sponsored several PostgreSQL developers and donated many resources back to the community,[3] but by late 2001 closed due to tough competition from companies like Red Hat and to poor market conditions.[4]

In 2001, Command Prompt, Inc. released Mammoth PostgreSQL, the oldest surviving commercial PostgreSQL distribution. It continues to actively support the PostgreSQL community through developer sponsorships and projects including PL/Perl, PL/php, and hosting of community projects such as the PostgreSQL Build Farm.

In January 2005, PostgreSQL received backing by database vendor Pervasive Software, known for its Btrieve product which was ubiquitous on the Novell NetWare platform. Pervasive announced commercial support and community participation and achieved some success. But in July 2006, it left the PostgreSQL support market.[5]

In mid-2005 two other companies announced plans to commercialize PostgreSQL with focus on separate niche markets. EnterpriseDB added functionality to allow applications written to work with Oracle to be more readily run with PostgreSQL. Greenplum contributed enhancements directed at data warehouse and business intelligence applications, including the BizGres project.

In October 2005, John Loiacono, executive vice president of software at Sun Microsystems, commented: "We're not going to OEM Microsoft but we are looking at PostgreSQL right now,"[6] although no specifics were released at that time. By November 2005, Sun had announced support for PostgreSQL.[7] As of June 2006, Sun Solaris 10 6/06 ships PostgreSQL.

In August, 2007, EnterpriseDB announced[8] the Postgres Resource Center [1] and EnterpriseDB Postgres, designed to be a fully configured distribution of PostgreSQL including many contrib modules and add-on components.

The PostgreSQL project continues to make yearly major releases and minor "bugfix" releases, all available under the BSD license, based on contributions from both commercial vendors, support companies, and open source programmers at large.

[edit] Features

[edit] Functions

Functions allow blocks of code to be executed by the server. Although these blocks can be written in SQL, the lack of basic programming operations, such as branching and looping, has driven the adoption of other languages inside of functions. Some of the languages can even execute inside of triggers. Functions in PostgreSQL can be written in the following languages:

PostgreSQL supports row-returning functions, where the output of the function is a set of values which can be treated much like a table within queries.

Functions can be defined to execute with the privileges of either the caller or the user who defined the function. Functions are sometimes referred to as stored procedures, although there is a slight technical distinction between the two.

[edit] Indices

User-defined index methods can be created, or the built-in B-tree, hash table and GiST indices can be used. Indexes in PostgreSQL also support the following features:

  • PostgreSQL is capable of scanning indexes backwards when needed; a separate index is never needed to support ORDER BY field DESC.
  • Expression indexes can be created with an index of the result of an expression or function, instead of simply the value of a column.
  • Partial indexes, which only index part of a table, can be created by adding a WHERE clause to the end of the CREATE INDEX statement. This allows a smaller index to be created.

[edit] Triggers

Triggers are events triggered by the action of SQL query. For example, an INSERT query might activate a trigger that checked if the values of the query were valid. Most triggers are only activated by either INSERT or UPDATE queries.

Triggers are fully supported and can be attached to tables but not to views. Views can have rules, though. Multiple triggers are fired in alphabetical order. In addition to calling functions written in the native PL/PgSQL, triggers can also invoke functions written in other languages like PL/Perl.

[edit] MVCC

PostgreSQL manages concurrency through a system known as Multi-Version Concurrency Control (MVCC), which gives each user a "snapshot" of the database, allowing changes to be made without being visible to other users until a transaction is committed. This largely eliminates the need for read locks, and ensures the database maintains the ACID principles in an efficient manner.

[edit] Rules

Rules allow the "query tree" of an incoming query to be rewritten. One common usage is to implement updatable views.

[edit] Data types

A wide variety of native data types are supported, including:

In addition, users can create their own data types which can usually be made fully indexable via PostgreSQL's GiST infrastructure.

Examples of these are the Geographic information system (GIS) data types from the PostGIS project for PostgreSQL.

[edit] User-defined objects

New types of almost all objects inside the database can be created, including:

[edit] Inheritance

Tables can be set to inherit their characteristics from a "parent" table. Data is shared between "parent" and "child(ren)" tables. Tuples inserted or deleted in the "child" table will respectively be inserted or deleted in the "parent" table. Also adding a column in the parent table will cause that column to appear in the child table as well. This feature is not fully supported yet—in particular, table constraints are not currently inheritable. This means that attempting to insert the id of a row from a child table into a table that has a foreign key constraint referencing a parent table will fail because Postgres doesn't recognize that the id from the child table is also a valid id in the parent table.

Inheritance provides a way to map the features of generalization hierarchies depicted in Entity Relationship Diagrams (ERD) directly into the PostgreSQL database.

[edit] Other features

[edit] Add-ons

  • Geographic objects via PostGIS. GPL.
  • Shortest-Path-Algorithms with pgRouting using PostGIS. GPL.
  • Full text search via Tsearch2 and OpenFTS. (As of 8.3, Tsearch2 included in core PostgreSQL)
  • Some synchronous multi-master derivatives or extensions exist, including
  • Several asynchronous master/slave replication packages, including
  • There are proxy (middleware) tools that enable replication, failover or load management and balacing for postgresql:
    • PGPool-II.
    • Sequoia available for a number of different server besides postgresql.

[edit] Database administration front-ends

[edit] psql

The primary front-end for PostgreSQL is the psql command-line program, which can be used to enter SQL queries directly, or execute them from a file. In addition, psql provides a number of meta-commands and various shell-like features to facilitate writing scripts and automating a wide variety of tasks; for example tab completion of object names and SQL syntax.

[edit] pgAdmin

pgAdmin is a graphical front-end administration tool for PostgreSQL, which is supported on most popular computer platforms. The program is available in more than a dozen languages, and is free software released under the Artistic License. The first prototype, named pgManager, was written for PostgreSQL 6.3.2 from 1998. The stable release (named pgAdmin II) was first released on 16 January 2002. The current version is pgAdmin III, which is released under the Artistic License.

[edit] phpPgAdmin

phpPgAdmin is a web-based administration tool for PostgreSQL written in PHP and based on the popular phpMyAdmin interface originally written for MySQL administration.[9]

[edit] Benchmarks

Many informal performance studies of PostgreSQL have been done[10] but the first industry-standard and peer-validated benchmark was completed in June 2007 using the Sun Java Systems Application Server 9.0 Platform Edition, UltraSPARC T1 based Sun Fire server and Postgres 8.2[11]. This result of 778.14 SPECjAppServer2004 JOPS@Standard compares favourably with the 874 JOPS@Standard with Oracle 10 on an Itanium based HP-UX [10]

In August 2007, Sun submitted an improved benchmark score of 813.73 SPECjAppServer2004 JOPS@Standard. With the system under test at a reduced price, the price/performance improved from $US 84.98/JOPS to $US 70.57/JOPS. [12]

[edit] Prominent users

[edit] Awards

As of 2008 PostgreSQL has received the following awards[21]:

  • 1999 LinuxWorld Editor's Choice Award for Best Database
  • 2000 Linux Journal Editors' Choice Awards for Best Database
  • 2002 Linux New Media Editors Choice Award for Best Database
  • 2003 Linux Journal Editors' Choice Awards for Best Database
  • 2004 Linux New Media Award For Best Database
  • 2004 Linux Journal Editors' Choice Awards for Best Database
  • 2004 ArsTechnica Best Server Application Award
  • 2005 Linux Journal Editors' Choice Awards for Best Database
  • 2006 Linux Journal Editors' Choice Awards for Best Database
  • 2008 Developer.com Product of the Year, Database Tool

[edit] See also

[edit] References

[edit] Notes

  1. ^ PostgreSQL: News: PosgreSQL 8.3.1, 8.2.7 Update Release
  2. ^ Project name - statement from the core team. archives.postgresql.org (2007-11-16). Retrieved on 2007-11-16.
  3. ^ Maya Tamiya (2001-01-10). Interview: Bruce Momjian. LWN.net. Retrieved on 2007-09-07.
  4. ^ Great Bridge (2001-09-06). "Great Bridge ceases operations". Press release. Retrieved on 2007-09-07.
  5. ^ John Farr (2006-07-25). Open letter to the PostgreSQL Community. Pervasive Software. Retrieved on 2007-02-13.
  6. ^ Rodney Gedda. "Sun's software chief eyes databases, groupware", Computerworld, 2005-10-05. Retrieved on 2007-02-13. 
  7. ^ Sun Microsystems (2005-11-17). "Sun Announces Support for Postgres Database on Solaris 10". Press release. Retrieved on 2007-02-13.
  8. ^ EnterpriseDB (2007-08-07). "EnterpriseDB Announces First-Ever Professional-Grade PostgreSQL Distribution for Linux". Press release. Retrieved on 2007-08-07.
  9. ^ phpPgAdmin Project (2008-04-25). About phpPgAdmin. Retrieved on 2008-04-25.
  10. ^ a b Josh Berkus (2007-07-06). PostgreSQL publishes first real benchmark. Retrieved on 2007-07-10.
  11. ^ SPECjAppServer2004 Result. SPEC (2007-07-06). Retrieved on 2007-07-10.
  12. ^ SPECjAppServer2004 Result. SPEC (2007-07-04). Retrieved on 2007-09-01.
  13. ^ Eric Lai. "Size matters: Yahoo claims 2-petabyte database is world's biggest, busiest", Computerworld, 2008-05-22. 
  14. ^ Thomas Claburn. "Yahoo Claims Record With Petabyte Database", InformationWeek, 2008-05-21. 
  15. ^ PostgreSQL affiliates .ORG domain
  16. ^ Sony Online opts for open-source database over Oracle
  17. ^ A Web Commerce Group Case Study on PostgreSQL
  18. ^ Rodney Gedda. "Open source PostgreSQL hits another Hi5", Computerworld, 2007-05-30. Retrieved on 2007-10-23. 
  19. ^ PostgreSQL at Skype. Skype Developer Zone (2006). Retrieved on 2007-10-23.
  20. ^ How Much Are You Paying For Your Database?. Sun Microsystems blog (2007). Retrieved on 2007-12-14.
  21. ^ PostgreSQL, Award Winning Software. postgresql.org (2008-01-19). Retrieved on 2008-01-31.

[edit] External links

[edit] About PostgreSQL

[edit] Documentation

Performance tuning documentation

[edit] External projects

The developers of PostgreSQL try to keep the system itself down to a set of "core" features, rather than encouraging extensions to be rolled into the main system. Here are places where "secondary" projects are managed: