Post GRE
Post GRE
Post GRE
What is Database?
Database
A database is an organized collection of data,
today typically in digital form. The database concept has evolved since the 1960s to ease increasing difficulties in designing, building, and maintaining complex information systems. The term database is correctly applied to the data and their supporting data structures, and not to the database management system (DBMS). The database data collection with DBMS is called a database system.
PostgreSQL
The world's most advanced open source database
PostsgreSQL
Is an open source object relational database
management system (ORDBMS) which supports server side-scripting languages and data warehousing. available for many platforms including
Linux
FreeBSD Solaris Microsoft Windows Mac OS X
PostgreSQL
It is fully ACID compliant, has full support for
foreign keys, joins, views, triggers, and stored procedures (in multiple languages). It also supports storage of binary large objects, including pictures, sounds, or video. It has native programming interfaces for C/C++, Java, .Net, Perl, Python, Ruby, Tcl, ODBC, among others,
Limit
Maximum Database Size Maximum Table Size Unlimited 32 TB
Value
1.6 TB
1 GB Unlimited 250 - 1600 depending on column types Unlimited
History of PostgreSQL
created at UCB by a computer science professor named Michael Stonebraker, who went on to become the CTO of Informix Corporation. Stonebraker started Postgres in 1986 as a followup project to its predecessor, Ingres, now owned by Computer Associates. The name Postgres thus plays off of its predecessor (as in "after Ingres"). Ingres, developed from 1977 to 1985, had been an exercise in creating a database system according to classic RDBMS theory.
project meant to break new ground in database concepts such as exploration of "object relational" technologies. In 1995, two Ph.D. students from Stonebraker's lab, Andrew Yu and Jolly Chen, replaced Postgres' POSTQUEL query language with an extended subset of SQL. They renamed the system to Postgres95. In 1996, Postgres95 departed from academia and started a new life in the open source world when a group of dedicated developers outside of Berkeley saw the promise of the system, and devoted themselves to its continued
Features of PostgreSQL
Procedural languages
Inheritance
Indexes
Triggers Schemas Multiversion
Replication
Asynchronous
notifications Security Contrib modules Foreign data wrappers Other features Add-ons Upcoming features
Procedural languages
Procedural languages (often called stored
procedures) allow blocks of code to be executed by the database server, and can be written in programming languages other than SQL and C.
Indexes
PostgreSQL includes built-in support for B+-
tree, hash, generalized search trees (GiST) and generalized inverted indexes (GIN).
Triggers
Triggers are events triggered by the action of
Schemas
In PostgreSQL, all objects (with the exception of
roles and tablespaces) are held within a schema. Schemas effectively act like namespaces, allowing objects of the same name to co-exist in the same database.
system called MVCC, which gives each transaction a "snapshot" of the database, allowing changes to be made without being visible to other transactions until the changes are committed.
Rules
Rules allow the "query tree" of an incoming query
to be rewritten. One common usage is to implement views, including updatable views. Rules, or more properly, "Query Re-Write Rules", are attached to a table/class and "Re-Write" the incoming DML (select, insert, update, and/or delete) into one or more queries that either replace the original DML statement or execute in addition to it.
Data types
A wide variety of native data types are supported, including: Boolean Arbitrary precision numerics Character (text, varchar, char) Binary Date/time (timestamp/time with/without timezone, date, interval) Money Enum Bit strings
and can be of any data type, including text and composite types) up to 1 GB in total storage size. Geometric primitives IPv4 and IPv6 addresses CIDR blocks and MAC addresses XML supporting XPath qu eries (as of 8.3) UUID (as of 8.3)
User-defined objects
New types of almost all objects inside the
Domains
Functions, including aggregate functions and
window functions Indexes including custom indexes for custom types Operators (existing ones can be overloaded) Procedural languages
Inheritance
Tables can be set to inherit their characteristics
Security
Internal
Security within the
External
PostgreSQL natively supports a broad number of authentication mechanisms including:
database is managed on a per-role-basis. A role is generally regarded to be a user (a role that can log in), or a group (a role which other roles are members of). Permissions can be granted or revoked on any object down to the column level, and can also allow/prevent the creation of new objects at the database, schema or table levels.
trust (no enforcement) password (either MD5 or plain-text) GSSAPI SSPI Kerberos ident (maps O/S user name as provided by an ident server to database user name) peer (maps local user name to database user name) LDAP RADIUS Certificate
Add-ons
ST-Links SpatialKit Postgres PostGIS pgRouting Performance Wizard
Installation
Requirement
(for building visual studio 2005 beyond) ActiveState Perl
ActiveState TCL Bison and Flex Diff Gettext Microsoft Platform SDK MIT Kerberos libxml2 and libxslt openssl ossp-uuid Python zlib
Building
To build all of PostgreSQL in release
$ENV{CONFIG}="Debug";
perl mkvcbuild.pl
of the debug or release directories. To install these files using the standard layout, and also generate the files required to initialize and use the database, run the command:
completed the build of all required parts first. To run the tests, run one of the following commands from thesrc\tools\msvc directory: vcregress check vcregress installcheck vcregress plcheck vcregress contribcheck
PostgresSQL Commands
ABORT -- abort the current transaction ALTER DATABASE -- change a database ALTER GROUP -- add users to a group or remove users from a group ALTER TABLE -- change the definition of a table ALTER TRIGGER -- change the definition of a trigger ALTER USER -- change a database user account ANALYZE -- collect statistics about a database BEGIN -- start a transaction block CHECKPOINT -- force a transaction log checkpoint CLOSE -- close a cursor CLUSTER -- cluster a table according to an index COMMENT -- define or change the comment of an object COMMIT -- commit the current transaction COPY -- copy data between files and tables CREATE AGGREGATE -- define a new aggregate function CREATE CAST -- define a user-defined cast CREATE CONSTRAINT TRIGGER -- define a new constraint trigger CREATE CONVERSION -- define a user-defined encoding conversion
CREATE DATABASE -- create a new database CREATE DOMAIN -- define a new domain CREATE FUNCTION -- define a new function CREATE GROUP -- define a new user group CREATE INDEX -- define a new index CREATE LANGUAGE -- define a new procedural language CREATE OPERATOR -- define a new operator CREATE OPERATOR CLASS -- define a new operator class for indexes CREATE RULE -- define a new rewrite rule CREATE SCHEMA -- define a new schema CREATE SEQUENCE -- define a new sequence generator CREATE TABLE -- define a new table CREATE TABLE AS -- create a new table from the results of a query CREATE TRIGGER -- define a new trigger CREATE TYPE -- define a new data type CREATE USER -- define a new database user account CREATE VIEW -- define a new view
DROP SCHEMA -- remove a schema DROP SEQUENCE -- remove a sequence DROP TABLE -- remove a table DROP TRIGGER -- remove a trigger DROP TYPE -- remove a user-defined data type DROP USER -- remove a database user account DROP VIEW -- remove a view END -- commit the current transaction EXECUTE -- execute a prepared query EXPLAIN -- show the execution plan of a statement FETCH -- retrieve rows from a table using a cursor GRANT -- define access privileges INSERT -- create new rows in a table
LISTEN -- listen for a notification LOAD -- load or reload a shared library file LOCK -- explicitly lock a table MOVE -- position a cursor on a specified row of a table NOTIFY -- generate a notification PREPARE -- create a prepared query REINDEX -- rebuild corrupted indexes RESET -- restore the value of a run-time parameter to a
default value REVOKE -- remove access privileges ROLLBACK -- abort the current transaction SELECT -- retrieve rows from a table or view SELECT INTO -- create a new table from the results of a query
SET -- change a run-time parameter SET CONSTRAINTS -- set the constraint mode of the
current transaction SET SESSION AUTHORIZATION -- set the session user identifier and the current user identifier of the current session SET TRANSACTION -- set the characteristics of the current transaction SHOW -- show the value of a run-time parameter START TRANSACTION -- start a transaction block TRUNCATE -- empty a table UNLISTEN -- stop listening for a notification UPDATE -- update rows of a table VACUUM -- garbage-collect and optionally analyze a database
default a page is 8kb ) pg_class system table, which maintains the details of relations limit 1 limits the output to display only one row.
Note: If you want it to be shown pretty, then use pg_size_pretty function which converts the size in bytes to human understandable format.