PostgreSQL[Encyclopedia]
来源:互联网 发布:江雷院士娶了学生知乎 编辑:程序博客网 时间:2024/05/17 08:28
PostgreSQL
From Wikipedia, the free encyclopedia
PostgreSQL is a free object-relational database server (database management system), released under a flexible BSD-style license. It offers an alternative to other database systems. Similar to other open-source projects such as Apache, Linux, and Mediawiki, PostgreSQL is not controlled by any single company, but relies on a global community of developers and companies to develop it.
PostgreSQL's unusual-looking name makes some readers pause when trying to pronounce it, especially those who pronounce SQL as "sequel". PostgreSQL's developers pronounce it "post-gress-Q-L". (Audio sample, 5.6k MP3). It is also common to hear it abbreviated as simply "postgres", which was its original name. The name refers to the project's origins as a "post-Ingres" database, the original authors having also developed Ingres.
Contents
[hide]- 1 Features
- 1.1 Functions
- 1.2 Indexes
- 1.3 Triggers
- 1.4 MVCC
- 1.5 Rules
- 1.6 Data types
- 1.7 User-defined objects
- 1.8 Inheritance
- 1.9 Other features
- 1.10 Add-ons
- 2 History
- 3 Prominent users
- 4 See also
- 5 References
- 6 External links
[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:
- A built-in language called PL/pgSQL resembles Oracle's procedural language PL/SQL
- Scripting languages are supported through PL/Perl, plPHP, PL/Python, PL/Ruby, PL/sh, PL/Tcl and PL/Scheme
- Compiled languages C, C++, or Java (via PL/Java)
- The statistical language R through PL/R
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] Indexes
User-defined indexes can be created, or the built-in B-tree, hash and GiST indices can be used. Indexes in PostgreSQL also support the following features:
- PostgreSQL is capable of scanning indexes backwards when needed; you never need a separate index to support
ORDER BY field DESC
. - Expressional 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 theCREATE INDEX
statement. This allows a smaller index to be created. - Bitmap index scans are supported as of version 8.1. This involves reading multiple indexes and generating a bitmap that expresses their intersection with the tuples that match the selection criteria. This provides a way of composing indexes together; on a table with 20 columns, there are, in principle, 20! indexes that could be defined - which is far too many to actually use. If you create one index on each column, bitmap scans can compose arbitrary combinations of those indexes at query time for each column that seems worth considering as a constraint.
[edit] Triggers
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:
- Arbitrary precision numerics
- Unlimited length text
- Geometric primitives
- IP and IPv6 addresses
- CIDR blocks, and MAC address data types
- Arrays
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:
- Indices
- Operators (and existing ones can be overloaded)
- Aggregates
- Domains
- Casts
- Conversions
[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 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
- Referential integrity constraints including foreign key constraints, column constraints, and row checks
- Views
- Full, inner, and outer (left and right) joins
- Sub-selects
- Transactions
- A high level of compliance with the SQL:2003 standard
- Encrypted connections via SSL
- Binary and textual large-object storage
- Online backup
- Domains
- Tablespaces
- Savepoints
- Point-in-time recovery
- Two-phase commit
- TOAST (The Oversized-Attribute Storage Technique) is used to transparently store large table attributes (such as big MIME attachments or XML messages) in a separate area, with automatic compression.
- Regular expressions [1]
[edit] Add-ons
- Geographic objects via PostGIS. GPL.
- Full text search via Tsearch2 and OpenFTS. GPL.
- Several asynchronous master/slave replication packages, including Slony-I (BSD license) and Mammoth Replicator (closed source, max 50 slaves, US $1,000 for one master and one slave).
- XML/XSLT support via XPath Extensions in the contrib section. GPL.
- PostgreSQL[Encyclopedia]
- Microsoft SQL Server[Encyclopedia]
- Encyclopedia Britannica 2007
- Microsoft Encyclopedia of Security
- Encyclopedia of Algorithms
- 推荐书《Encyclopedia of GIS》
- Comparison of SQL syntax[Encyclopedia]
- Encyclopedia of Information Communication Technology
- Linux shell encyclopedia, very useful
- postgreSQL
- PostgreSQL
- PostgreSQL
- postgresql
- postgresql
- PostgreSQL
- PostgreSQL
- PostgreSQL
- PostgreSQL
- Microsoft SQL Server[Encyclopedia]
- JAVA面试题最全集(1)
- 一本你肯定可以读懂的Java图书
- JAVA面试题最全集(3)
- 电影[如果.爱],张学友.金城武.周迅
- PostgreSQL[Encyclopedia]
- JAVA面试题最全集(4)
- JAVA面试题最全集(5)
- 判断32位整数二进制中1的个数的算法
- JAVA面试题最全集(6)
- SQL Server 2000 vs Sybase ASE 12.5
- JAVA面试题最全集(7)
- JAVA面试题最全集(8)
- JAVA面试题最全集(9)