���� ���������� ����������: ������� 16 �������� 14:07:22 EDT 2005
���������� ������� ������������: ���� ������ (Bruce Momjian) (pgman@candle.pha.pa.us)
����ף� �� �������: ������ ���������� (admin@linuxshare.ru)
����� ������ ���������� ������ ��������� ����� ����� �� http://www.PostgreSQL.org/files/documentation/faqs/FAQ.html.
������ �� ������� ����������� ��� ���������� �������� ����� ����� �� http://www.PostgreSQL.org/docs/faq/.
PostgreSQL ������������ Post-Gres-Q-L (����-����-���-��), ����� ������ ������� ������ Postgres. �� ������ �������� ��� ��� ������������ � ������� ����������, ������� �������� � ������� MP3.
PostgreSQL - ��� ��������-����������� ������� ���������� ������ ������ (����), ������� ����� ������������ ����������� ������������ ���� � ������������, ������� ���� � ���� ������ ���������. PostgreSQL - ��� ��������� � ��������� �������� ����������� �����������.
���������� PostgreSQL ��������� ������� �������������, ������������ �� ����� ���� � ��������� ����� ��������. ���������� �������� ������������ �������� � �� ����������� �����-���� ���������. ����������� �������� � FAQ ��� �������������, http://www.PostgreSQL.org/files/documentation/faqs/FAQ_DEV.html
PostgreSQL ���������������� �� ������������ �������� BSD. ��� �������� �� �������� ����������� �� ��, ��� ����� �������������� �������� ���. ��� �������� ��� �������� � � ��� ��� ��������� ţ ������.
��� ��� �������� BSD, ������� �� ����������:
������� ���������� ������ ������ PostgreSQL
Portions copyright (c) 1996-2005, PostgreSQL Global Development Group Portions Copyright (c) 1994-1996 Regents of the University of California
��������������� ����� �� �������������, �����������, ��������� � ��������������� ������� ������������ ����������� � ��� ������������ ��� ����� �����, ��������� � ��� ���������� ������-���� ����������, ��� ������� ��� ��� ������ ����� ����� ������������� ������ ���� ��������� �� ��������� ������, ������� �������� � ��� ��������� ���������.
�������������� ����������� �� ����� ������� ��������������� �� ����� �����������, ������� ������ ������, ���������� ������ ��� ��������, ����������� ��� ��������� �������������� ������� ������������ ����������� ��� ��� ������������, ���� ���� �������������� ����������� ��� ������� � ����������� ����� �����������.
�������������� ����������� ���������� ���������������� ������������� ����� ��������, �������, �� �� ������������� ������ ����� ����������: ������� �������� ����������� ������ ��� ����������� ��� ��������� ����. ������ ����������� ����������� ��������������� �� ������ ������� "��� ����" � �������������� ����������� �� ������ ������������� �������������, ���������, ����������, ���������� ��� ���������.
������, PostgreSQL ����� �������� �� ����� ����������� ��������� ����������� � Unix. � ���������� �� ���������, �� ������� ������ ��� ��������, �� ������� ���� ��������� �������� ������� PostgreSQL � ������� ������ ������ ������.
PostgreSQL ����� �������� �� ������������ �������� Microsoft Windows, ���������� �� NT, ����� ��� Win2000, WinXP � Win2003. ����� ������������ �������� �� ������ http://pgfoundry.org/projects/pginstaller. ������ Windows, ���������� �� MS-DOS (Win95, Win98, WinMe) ����� ��������� PostgreSQL � ������� Cygwin.
����� ���������� ������ �������������� ��� Novell Netware 6 �� http://forge.novell.com, � ������ ��� OS/2 (eComStation) �� http://hobbes.nmsu.edu/cgi-bin/h-search?sh=1&button=Search&key=postgreSQL&stype=all&sort=type&dir=%2F.
����� �������, ��������� http://www.postgresql.org/ftp/ � ����� ftp, ��������� ftp://ftp.PostgreSQL.org/pub/.
���������� PostgreSQL ������������� ������ ��������� ������������� ����� E-mail. �������� web-���� ��� �������� �� ������ �������� �� E-mail ���: http://www.postgresql.org/community/lists/. ������� ������ ��� ����, ����� ������ �������� ������� �������� ������ general (����� �������) ��� bugs (������).
������� IRC ������� �������� #postgreql,
������������� �� ������� Freenode (irc.freenode.net). �����
������������, �� ������ ������������ � Unix ����� ���������
irc -c '#postgresql' "$USER" irc.freenode.net
���
����� ������ IRC ������. �� ���� �� ������� ���������� ������ ��
��������� (#postgresql-es) � ����������� (#postgresqlfr)
������. ����� ���������� ����� �� PostgreSQL �� ������� EFNet.
������ ������������ ��������� �������� �������� �� http://techdocs.postgresql.org/companies.php.
�������� ��������� �� ����������� ������ ��ޣ�� �� ������ � PostgreSQL �� ������: http://www.postgresql.org/support/submitbug.
����� ��������� ������� ����� ������ ������ PostgreSQL �� ����� FTP ����� ftp://ftp.PostgreSQL.org/pub/.
��������� ������ PostgreSQL - ��� ������ 8.0.3
�� ��������� ��������� ����� ������� ������ ������ ���, � ������� ������ ������ ��������� �������.
PostgreSQL �������� ����� ������������, ������� ������� �����������, �������� ������������ ����������� man � ��������� ��������� �������� �������. �������� � ������� /doc. �� ����� ������ ������������� ������������ � �������� �� ������ http://www.PostgreSQL.org/docs.
���������� ��� ����� �� PostgreSQL ��������� �� ������� http://www.PostgreSQL.org/docs/books/awbook.html � http://www.commandprompt.com/ppbook/. ���� ��������� ���� �� PostgreSQL, ������� ����� ������. ���� �� �������� ���������� ������� ����� ������ (Korry Douglas). ������ ������� �� ���� ������ �������� �� ������ http://techdocs.postgresql.org/techdocs/bookreviews.php. ����� ����, �� ������ http://techdocs.PostgreSQL.org/ �� ������ ����� ��������� ����������� ������ ����������� PostgreSQL.
������ ��������� ������ psql ����� ��������� ������ \d ��� ����������� ���������� �� �����, ����������, ��������, ��������� � �.�. - ����������� \? ��� ��������� ������ ��������� ������.
��� ���� �������� ��� ������ ����������.
PostgreSQL ������������ ����������� �������� SQL-92. �������� ��� ������ TODO �� ������� ��������� ������, ������������� ������������ � ������� ������.
��-������, �������� ���� �� ���� �� PostgreSQL, � ������� ���������� ����. ��� ���� ������� - ��� ����� "Teach Yourself SQL in 21 Days, Second Edition" (����� �������������� SQL �� 21 ����, ������ ��������) �� http://members.tripod.com/er4ebus/sql/index.htm. ������ �� ����� ������������� �������� ����� The Practical SQL Handbook, Bowman, Judith S., et al., Addison-Wesley. ������ �������� The Complete Reference SQL, Groff et al., McGraw-Hill.
���� ���������� ������� �� http://www.intermedia.net/support/sql/sqltut.shtm, �� http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM, � �� http://sqlcourse.com.�������� FAQ ��� �������������.
���������� ��������� ������� ��������� ������������ �����������: �����������, ������������������, ����������, ��������� � ����.
���� �� ����� ������-�� ���������� ��������, ����������� ������� ��� ����������� ��������, �� �������� --- �� ���. � ��� ���� ���� �������� � �������������, ���������� � CVS, �� ��� ������ ������ ������ ��� ���������������� �����, ��� ��� ����������. ������ �������� ������������� � ������� ���������� ������������� � �������������, � �������� ����� ������������� ������. �ӣ ��� ����� -- ��� ����������� �� ������ �������� � ����������� � ����������. (����������� � ��� ��� ���������� � ���������� PostgreSQL �������� � FAQ ��� �������������.)
��������� PostgreSQL �������� ������ C � ���������� (embedded) C ����������. ��� ������ ���������� �������� ������������ ��������� � ����������� ��������; ����������������� �������� ��������� �� ������������ ����������� ���������� �������� ����� ������ � ����� ����������� ������� �������������.
��������� ����� ����������������, ����� ��� PHP �������� � ���� ��������� � PostgreSQL. ���������� ��� ����� ������ ��� Perl, TCL, Python � ������ ������, �������� �� http://gborg.postgresql.org � ������ Drivers/Interfaces, � ����� ����� ����� � ��������.
���������� �������� �� �������������� ��� ������ � Web ����� ����� ��: http://www.webreview.com
��� ���������� � Web, PHP http://www.php.net �������� �������� �����������.
� ������� �������, ������ ���������� Perl � DBD::Pg � CGI.pm ��� mod_perl.
��, ����������� �������� � http://techdocs.postgresql.org/guides/GUITools.
������� ����� --prefix ����� ���������� configure.
�� ���������, PostgreSQL ��������� ������ ���������� �� ��������� ������ ����� ������ ������ Unix ��� TCP/IP ����������. ��� ����, ����� ������ ������ ������ ������������ � ���� �� ������ �������� listen_addresses � postgresql.conf, ��������� host-����������� � ����� $PGDATA/pg_hba.conf � �������������� ������.
���������� ��� ������� �������, ������� ������������ ����� ��������� ������������������:
���� ��������� ��������� � ���������� �������, ������������
�� log_*
, ����������� ��������������� �������
� ���������� ������ ��������, ������� ����� ������� ��� �������
� ��������� ������������������.
�� �������� �������������� �� ��������� ����������� �� 100 ������ ����������� � ���� ������. ��� ���������� ��������� ��� postmaster ����� �� ���������� ������������ backend ���������, ������� �������� max_connections � ����� postgresql.conf � �������������� postmaster.
������������ PostgreSQL ������ ������ ��������� ��������� ����� ������������. ����� ������� ���������� � ������ 7.4.0 �� 7.4.1 �� ������� ���������� dump � restore. ������ ��� ������ ���������� ������� (�.�. ��� ���������� ��������, � 7.3 �� 7.4) ����� �������� ���������� ������ ��������� ������ � ������ ������. ��� ��������� ����� ����� ����������� ��������, ��� ��� ��� ����������� ���������� �������� ������������� ������ ������. ��������� dump ��������� �������� ������ � ����� �������, ������� ����� ����� ���� �������� ��� ������������� ������ ����������� �������.
� ��� ��������, ��� ������ ������ �� ����� �� ��������, ��� ���������� ���������� ����� ���� ����������� �������� pg_upgrade ��� ������������� dump/restore. ����������� � ������� ������� ����� ����� ������������ pg_upgrade ��� ����� �������.
��������� "������" ������������ ����������� �������� �������� �����������, ���� ������� ������, ��� ����� "������" ����� ���������� ��������. ��� �� ���. ������ ECC, SCSI � ������������ ����������� ����� �������� ����� ������ � ����� ����� ������ ������������������, ��� ����� ������� "������". PostgreSQL ����� �������� �� ����� "������", �� ���� ��� ��� ����� ������� � ������������������, �� � ����� ������� ����� ����� ��������� ��������������� "������". �������� ������ "������" ����� � ����� ������� ��������.
��� ��������� ������ ���������� �����, ���� �� ������ �� ���������� �� ������ ���������� SELECT ����������� LIMIT.
���� ���� �����-���� ������, ������� ��������� � ORDER BY, �� ��������, ��� ���� ������ �������� � �� �����. ���� �� �� ������ ���������� ����������� ����� �� ������ ���������� SELECT, ����������� ������ � FETCH.To SELECT a random row, use:
SELECT col FROM tab ORDER BY random() LIMIT 1;
����� ������������� ������� � psql, ����������� ������� \dt. ������ ������ ������ � psql �� ������ ��������, ��������� \?. ����� ����, �� ������ ���������� �������� ��� psql � ����� pgsql/src/bin/psql/describe.c. �� �������� ������� SQL ������� ������������ ��� ����� � psql ������, ������������ � �������� ����� �����. �� ����� ������ ��������� psql � ������ -E ���, ����� ��� ��������� �������� �������, ������� ��� ���������� ��� ���������� �������� ���� ������. PostgreSQL ����� ������������� SQL ����������� � INFORMATION SCHEMA ���������, � ������� ��������, �� ������ ������������ ������ �� ��������� ���������� � ���� ������.
����� ���������� ��������� �������, ������������ � pg_.
����������� psql -l ��� ��������� ������ ���� ��� ������.
����� ���������� ���� pgsql/src/tutorial/syscat.source. �� ���������� ������ �� ���������� SELECT ����������� ��� ��������� ���������� �� ��������� ������ ���� ������.
� 8.0 � ����� ������� �������, ��������� ���� ������� ����������� ����� ����� ����� ALTER TABLE ALTER COLUMN TYPE.
� ����� ������ ������� �������� ���:
BEGIN; ALTER TABLE tab ADD COLUMN new_col new_data_type; UPDATE tab SET new_col = CAST(old_col AS new_data_type); ALTER TABLE tab DROP COLUMN old_col; COMMIT;
���������� ��������� �����������:
������������ ������ ����? ����������� (���������� ���� �� 32 TB) ������������ ������ �������? 32 TB ������������ ������ ������? 1.6 TB ������������ ������ ����? 1 GB ������������ ���������� ����� � �������? ������������ ������������ ���������� ������� � �������? 250-1600 � ����������� �� ���� ������������ ���������� �������� � �������? ������������
����������, ������� "������������" �� ����� ���� �������������� ��������� �������� �������������� � ��������� ������/���������. ����� �������� ������������� ���� ����������� �������, ����� ���������� ������������������.
������������ ������ ������� � 32 TB �� ������� ����� ������������ ������� ������������ ����� ������� ��������. ������� ������� �������� ��� ��������� ������ �������� � 1 GB, ��� ��� �����������, ������� ����������� �������� ������� �� �����.
������������ ������ ������� � ������������ ���������� ������� ����� ���� ��������� � ������ ����, ���� ������ ����� �� ��������� ����� �������� �� 32k.
���������� �����������, �� �������� ������� �� ����� ����������� ��� ������� ������� ��� 2,000 ��������. � ������� ����� ������� ���� �� ������������� ����-�� �����. ������������ ������������� �������� �������, � ������� ��������������� ������� �� ���� MD5 ������� �������, � �������������� �������������� ��������� ������ ����� ������ �������.
���� PostgreSQL ����� ������������� ��������� ������������ �� 5 ��� ������ ��� ���������� ������ �� �������� ���������� �����.
� �������� �������, ���������� ���� � 100,000 ����� � ������, �� ������� ����� ����� � ��������� ��������. ��� ���� ����� ������, � �������, ���������� 20 ����. ������ �������� ����� �������� 2.8 MB. ������ ���� PostgreSQL, ���������� ��� �� ������ �������� �������������� 6.4 MB �� �������:
28 ����: �� ������ ��������� ������ � ������� (��������������) + 24 �����: ���� ���� � ������������� ����� � ���� ��������� ���� + 4 �����: ��������� �� �������� ��� ���� ��������� ������ ---------------------------------------- 56 ���� �� ������ � ������� ������ �������� ������ � PostgreSQL ���������� 8192 ���� (8 KB), ��� ���: 8192 ���� �� �������� --------------------- = 146 ����� � ������� �� �������� �� (�����̣���) 56 ���� �� ������ � ������� 100000 ����� ������ ----------------------- = 685 ������� � �� (�����̣���) 146 ����� � ������� �� �������� 685 ������� �� * 8192 ���� �� �������� = 5,611,520 ���� (5.6 MB)
������� �� ������� ��� �����, �� ��������� ��� ��������� ��� �������� ���������� ������, ��� ����� ����� ���� ������.
�������� NULL �������� ��� ������� ����� � ������� ��� �������� ����� ���� �����.
������� �� ������������ ��� ������� �������. ��� ������������ ������ ���� ������� ������ ������������ ������� � ������ �������� ������ ��������� ������� ����� � �������. ��� ��������, ������ ��� ������ � ����� � ����������� ������������ ��� ������������ �������� ����� ���� ���������, ��� ������� ������ ������� ��� �� ���������������� ������������.
����� ���������� ������������� ������������� ������� ��� �����-���� �������, PostgreSQL ������ ����� ���������� �� ���� �������. ��� ���������� ���������� ��� ������������� VACUUM ANALYZE ��� ������ ANALYZE. ��������� ����������, ����������� ������ � ��� ��� ����� ����� � ������� � ���� �� ������ ������������ �������, �� �� ����� ��������� ������ �������. ���������� ����� ������ �� ����������� ������������ ������� ���������� � ������ ����������. ��� ��������� ����������� ������� ������ ������������ ���������� ���� ����������.
������ ������� �� ������������ ��� ORDER BY ��� ��� ���������� ����������. ���������������� ������� ��������� �� ����� ����������� ������ �������, ��� ����� �� �������� � ������� �������. ������, ORDER BY ����� ������������� � LIMIT � � ���� ������ ������ ����� ��������������, ��������� ��� ���������� ����� ������������ ��������� ����� �������. ���������� MAX() � MIN() �� ���������� �������, �� ������ ������������ ��� ���������� �������� � ORDER BY � LIMIT:
SELECT col FROM tab ORDER BY col [ DESC ] LIMIT 1;
���� ��� �������, ��� ����������� ����������� �������� ����������������
�������, ����������� SET enable_seqscan TO 'off'
�
��������� ������ �����, ����� �������, ������������� �� ������������
�������� �������.
����� ������������ �������� � ���������, �������� LIKE ��� ~, ������� ����� ���� ������������ � ��������� �������:
text_pattern_ops
������� �������� ������ ���
LIKE ��������������.� �������� �� ������ 8.0, ������� ����� ������ ���� ������������, ���� ���� ������ ����� �� ��������� � ���������� ������ �������. ��� �������� �������� int2, int8 � numeric �������� �������.
�������� �������� ����������� ����������� EXPLAIN.
�������� ~ ���������� ����� ����������� ���������, � �������� ~* ���������� ����������� �� �������� ���� ����� ����������� ���������. ����������� �� �������� ������� LIKE ���������� ILIKE.
����������� �� �������� ��������� ������ ���������� ���:
SELECT * FROM tab WHERE lower(col) = 'abc';��� ����������� �� ����� ������������ ����������� ������. ������, ���� �� ��������� ������ ���������, �� ����� �����������:
CREATE INDEX tabindex ON tab (lower(col));
���� ������������� ������ ��������� ��� UNIQUE, �� �������, ��� ������� �� ��������� ����� ������� ������� � � �������, � � ������ ��������, ����� �� ����� ����� ���������� ��������, ������� ���������� ������ ���������. ����� � ������� ����� ���� ������� ������� ������ � ������̣���� ��������, ����������� ����������� CHECK ��� �������� ����� �������.
�� ������ ����������� �������� � IS NULL � IS NOT NULL, ��� �����:
SELECT * FROM tab WHERE col IS NULL;
����� ������������� ������ �� ��������
SELECT * FROM tab ORDER BY (col IS NOT NULL);
��� ���������� ��� ��������� VARCHAR(n) varchar ������ ������ ������������ �����, ��� ���������� CHAR(n) bpchar ����������� �������� �� ������������� ����� TEXT text ��� ����������� �������� ����������� ��� ����� BYTEA bytea ������ ���� ���������� ����� (����� ������������ null-���� ��� ������) "char" char ���� ������
���������� ��� �� ������ �������, ����� �������� ��������� �������� � � ��������� ���������� �� �������.
������ ������ ���� �������� "varlena" ������ (�.�., ������ ������ ����� �� ����� �������� �������, �� ������� ������� ������). ����� �������, ���������� ������������ ������������ ������, ��� ������������ ������. ������, ������� �������� ����� ���������, ��� ��� ���������� �������� ������������ ����� ����� ���� � ������, ��� ���������.
VARCHAR(n) - ��� ������ �������, ����� ����� ������� ������ ���������� �����, �� ����������� ������������� �������. TEXT - ��� ������ ������� ��� ����� �������������� �����, � ����������� ���������� ������ � 1 ��������.CHAR(n) - ��� ������ ������� ��� �������� �����, ������� ������ ����� ���������� �����. CHAR(n) ����������� �������� �� �������� �����, � �� ����� ��� VARCHAR(n) ������ ������ �������, �� ������� ������� ������. BYTEA ������������ ��� �������� �������� ������, �������� ������� ����� �������� NULL �����. ��� ���� ��������� �����, ����� ������� �������������� ������������������.
PostgreSQL ������������ ��� ������ SERIAL. �� ������������� ������� ������������������. ��������:
CREATE TABLE person ( id SERIAL, name TEXT );������������� ������������� �:
CREATE SEQUENCE person_id_seq; CREATE TABLE person ( id INT4 NOT NULL DEFAULT nextval('person_id_seq'), name TEXT );�������� ����������� � ������������������� �� �������� ����������� ����������� create_sequence.
���� �� �������� ������� � ��������� ���������� �������� SERIAL �� ������� sequence � ������� ������� nextval() ����� �������� � ����� ��������� ��� �������� ����. ����������� �������-������ � 4.11.1, ������ � ����������� ������� ��� ��� ��������:
new_id = execute("SELECT nextval('person_id_seq')"); execute("INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal')");����� �� ������ ����� ��������� ����� �������� � ����������
new_id
��� ��� ������������� � ������ �������� (��������
����� ��� ������� ���� ��� ������� person
). �������,
��� ��� ������������� ���������� ������� SEQUENCE
����� <table>_<serialcolumn>_seq,
��� table � serialcolumn �������� ��������������
������� ����� ������� � ����� ������� SERIAL.
� �������� ������������, �� ������ �������� ����������� �������� SERIAL � ������� ������� currval() ����� ���������� ������� �������� �������, ��������
execute("INSERT INTO person (name) VALUES ('Blaise Pascal')"); new_id = execute("SELECT currval('person_id_seq')");
���. currval() ���������� ������� ��������, ����������� ����� �������, � �� ������� ��������.
��� ���������� �������������, �������� �������������������, ��� ������������� �������� �� ����� ������� ���������� � �� ����������� �� ������� ���������� ����������. ��� ����� �������� ������� � ��������� ��� ������ ����������.
������, ����������� � PostgreSQL ��������� ������, �������� ���������� �������������� OID �� ����������� ������ ����� �������������� WITHOUT OIDS. OID - ��� ������������� ����������� ���������� 4-� �������� ����� �����. ������, ����� ���� ��� ��� �������� �������� 4 ���������, �������� OID �������� �������������. PostgreSQL ���������� OID ��� ���������� ����� ���������� ������.
��� ���������� �������� � �������� ������� ������������, ������ �������� �������� ������������� SERIAL ������ OID, ������ ��� ������������������ SERIAL ��������� ������ ������ ������� � ����� ������� ������ ���������� ������������. ��� �������� �������� 8-�� ������� ������������������ �������� ��� SERIAL8.
CTID ������������ ��� ������������� ����������� ���������� ������� � �������� � offset ����������. CTID ���������� ����� ���� ��� ������ � ������� ���� �������� ��� �����������.
TID ������������ ���������� �������� � �������� ��������� �� ���������� ������.
���������������� � ��� ����������� ����������� ������ ��� ��� ���� ���� ����� ��������� ����� �� ������������ �������. ����������� ����� �������� postmaster ��������� ��������� �������:
ulimit -d 262144 limit datasize 256m� ����������� �� ���������� �������������� shell, ������ ���� �� ������ ������ ���������� �������, �� ��� �������� ��� ���������� ������� ������� ������ �������� � �������� ����� ��������. ��� ������� �������� ��������� �������� �������� � ���� ��� ��������, ��������� ����� ţ �������. ���� � ��� �������� �������� � SQL ��������, ������ ��� backend ���������� ������� ������� ����� ������, ����������� ��������� ��� ������� ����� �������� �������.
�� psql, �������� SELECT version();
����������� CURRENT_TIMESTAMP:
CREATE TABLE test (x int, modtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
PostgreSQL ������������ ������� ����������, ��������� ����������� ��������� SQL. ��� ��� �������:
SELECT * FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);���
SELECT * FROM t1 LEFT OUTER JOIN t2 USING (col);
��� ���������� ������� ���������� t1.col � t2.col, ����� ���������� ����� ����������� ������ � t1 (������� �� ��������� � t2). RIGHT ���������� ������ �������� ����������� ������ t2. FULL ���������� ������ ���������� ��������� ������ ���� ��� ����������� ������ �� t1 � t2. ����� OUTER �������� �������������� � ����������� � LEFT, RIGHT � FULL �����������. ������� ���������� ���������� INNER ����������.
�� ���������� ������� ������� ������ � ����� ������ �������� �� �������. ��������� PostgreSQL ��������� ��������� �������� ����������� ��� ���� ������, ��������� ����, ��� ������ ���� ����� ����� ���������� ������.
contrib/dblink ��������� ������� ����� ������, ��������� ������ �������. ����������, ������ ����� ������������ ����� ������������� ����������� � ���������� ������ ������ � ����� ������� ���������� ���������� �� ���.
�� ������ ����� ������������ �������, ������������ ������, http://techdocs.postgresql.org/guides/SetReturningFunctions.
PL/PgSQL �������� �������� ������� � ���� �� ���������� �������� ����� ������� � ���, ��� ���� ������� PL/PgSQL ���������� � ��������� ������� � ��� ������� ������� ��������� � �������������, � ������� ����� ���������� �����, �� �� ����� �������� � ������, ������ ��� ������������� ���������� ������� �������� ��������� �� ������ ��������� �������. ����� ������ ��� ��������, ����������� EXECUTE ��� ������� � ��������� �������� � PL/PgSQL. ������������� ����� ��������� �������� ������ ������������������ ������ ���.
���� "����������" -- ��� ������ ������, ���� ��������� ������ ���������� ��� ���������� ���������� � ������� ������������� ��� ������.
���������� Master/slave ��������� ����� ���� ������� (master) ������ ��� ���������� �������� ������/������, � �� ����� ��� ��������� (slave) ������� ����� ����������� ������ ������� ������/SELECT. �������� ���������� �������� ��� ���������� master-slave � PostgreSQL �������� Slony-I.
���������� Multi-master ��������� ��������� ������� ������/������ �� ����������, ������������� ���� � ������ �����������. ��� ����������� ����� �������� � ������ ������������������, ������ ��� ���������� ������������� ��������� ����� ����������� ���������. �������� ���������� �������� ��� ����� ���������� � PostgreSQL �������� Pgcluster.
�������� ����� ��� ���������� ��-�� ������������� ������� ������� � ����� ������� ��� ������� ��� �������� �������. ��� ������������� ������� �������, ��� ������� � ������� (������� �������� ����������������) ����������� � ��������-��������� ����; ��� ��������, ��� �� ������ ������������ ������� �������, ����� ���������� ��� ����� � �������. ��������� ����������, ����� ��� pgAdmin, �� ����� �������� ������� ��������� ������� ������� �������������. ����� �������, ����� �������������� �������������� �� ������ ��������� ������ �� ��������� ������: