Commit 590102c2 authored by Bruce Momjian's avatar Bruce Momjian

This version has been synchonized with English version at Mar 03.

With best wishes,Victor Vislobokov
Perm, Russia
parent 7bf7b0bd
PostgreSQL Current directory is /root
: 18 17:56:04 EST 2002 drwxr-xr-x 19 root wheel 1024 Mar 4 05:01 ../
drwxr-xr-x 2 root wheel 512 Dec 29 13:36 Calendar/
: (Bruce Momjian) drwx------ 8 root wheel 9216 Mar 1 06:08 Mail/
(pgman@candle.pha.pa.us) drwx------ 8 root wheel 9216 Mar 1 06:08 News/
lrwxr-xr-x 1 www wheel 16 Mar 4 20:39 calendar -> /users/n
: (victor_v@permonline.ru) uyu/mcal
drwxr-xr-x 2 root wheel 512 Mar 4 16:56 download/
-r--r--r-- 1 root wheel 409 Feb 27 05:00 notes
http://www.PostgreSQL.org/docs/faq-english.html.
http://www.PostgreSQL.org/users-lounge/docs/faq.html.
_________________________________________________________________
1.1) PostgreSQL? ?
1.2) PostgreSQL?
1.3) Unix PostgreSQL?
1.4) Unix ?
1.5) PostgreSQL?
1.6) ?
1.7) ?
1.8) ?
1.9)
?
1.10) SQL?
1.11) PostgreSQL 2000- (Y2K)?
1.12) ?
1.13) ?
1.14) PostgreSQL ?
1.15) PostgreSQL?
2.1) ODBC PostgreSQL?
2.2) PostgreSQL
Web?
2.3) PostgreSQL ?
? ?
2.4) PostgreSQL?
3.1) PostgreSQL
/usr/local/pgsql?
3.2) postmaster, Bad System Call
core dumped. ?
3.3) postmaster,
IpcMemoryCreate. ?
3.4) postmaster,
IpcSemaphoreCreate. ?
3.5) ?
3.6)
?
3.7) ?
3.8) "Sorry, too many clients"
?
3.9) pg_sorttempNNN.NN
?
4.1) ?
4.2) SELECT
?
4.3) psql?
4.4) ?
4.5) , ?
4.6)
?
4.7) ,
?
4.8)
. ?
4.9) , ?
4.10) R-tree ?
4.11) Genetic Query Optimizer?
4.12)
?
?
4.13) , NULL -
?
4.14) ?
4.15.1) serial/--?
4.15.2) SERIAL?
4.15.3) , currval()
nextval() ?
4.15.4)
?
, /SERIAL?
4.16) OID? TID?
4.17) PostgreSQL?
4.18) "ERROR: Memory exhausted in
AllocSetAlloc()"?
4.19) , PostgreSQL ?
4.20)
"invalid large obj descriptor"?
4.21)
?
4.22) , IN ?
4.23) ?
4.24) , ?
PostgreSQL
5.1) .
psql, dump core?
5.2)
PostgreSQL?
5.3) C , ?
5.4) .
?
_________________________________________________________________
1.1) PostgreSQL?
PostgreSQL Post-Gres-Q-L (---).
PostgreSQL - POSTGRES,
. PostgreSQL
POSTGRES,
PostQuel SQL. PostgreSQL -
.
PostgreSQL , Internet,
.
, (Marc G.
Fournier) (scrappy@PostgreSQL.org). (. ,
).
PostgreSQL.
PostgreSQL 1.01 (Andrew Yu)
(Jolly Chen).
, , .
Postgres, PostgreSQL,
,
,
(Michael Stonebraker)
, .
, , Postgres. 1995
SQL,
Postgres95. 1996 PostgreSQL.
1.2) PostgreSQL?
PostgreSQL COPYRIGHT:
PostgreSQL
Portion copyright (c) 1996-2002, PostgreSQL Global Development Group
Portions Copyright (c) 1994-6 Regents of the University of California
, ,
, - ,
,
.
, , ,
,
.
, , :
.
" "
, , , .
BSD ,
.
.
ţ .
1.3) Unix PostgreSQL?
, PostgreSQL
Unix. ,
, PostgreSQL
.
1.4) Unix ?
MS Windows C
libpq, psql . ,
MS Windows TCP/IP ,
Unix .
win31.mak ,
libpq psql Win32. PostgreSQL
ODBC.
Windows NT Win2k,
Cygwin,
Unix NT. pgsql/doc/FAQ_MSWIN MS Windows
FAQ . PostgreSQL
- Microsoft.
1.5) PostgreSQL?
, ftp PostgreSQL
ftp://ftp.PostgreSQL.org/pub.
.
1.6) ?
: pgsql-general@PostgreSQL.org.
, PostgreSQL. ,
, (
) :
subscribe
end
pgsql-general-request@PostgreSQL.org.
. ,
:
pgsql-general-digest-request@PostgreSQL.org
:
subscribe
end
,
30 .
.
,
pgsql-bugs-request@PostgreSQL.org
:
subscribe
end
.
,
pgsql-hackers-request@PostgreSQL.org
:
subscribe
end
PostgreSQL
PostgreSQL :
http://www.PostgreSQL.org
IRC EFNet, #PostgreSQL.
Unix irc -c
'#PostgreSQL' "$USER" irc.phoenix.net.
http://www.postgresql.org/users-lounge/commercial-support.html.
1.7) ?
PostgreSQL - 7.2.
.
1.8) ?
,
man .
/doc.
http://www.PostgreSQL.org/users-lounge/docs/.
PostgreSQL
http://www.PostgreSQL.org/docs/awbook.html
http://www.commandprompt.com/ppbook/. PostgreSQL,
http://www.postgresql.org/books/. ,
http://techdocs.postgresql.org/
PostgreSQL.
psql \d
, , , ..
.
1.9)
?
PostgreSQL SQL-92.
TODO ,
.
1.10) SQL?
PostgreSQL http://www.PostgreSQL.org/docs/awbook.html
SQL. PostgreSQL
http://www.commandprompt.com/ppbook.
http://www.intermedia.net/support/sql/sqltut.shtm,
http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM,
http://sqlcourse.com.
- "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.
1.11) PostgreSQL 2000- (Y2K)?
, 2000 2000 .
1.12) ?
,
PostgreSQL
. , pgsql-hackers
pgsql-patches. , (patches)
pgsql-patches.
,
CVS PostgreSQL.
,
, , ,
.
1.13) ??
PostgreSQL BugTool,
.
ftp://ftp.PostgreSQL.org/pub
PostgreSQL .
1.14) PostgreSQL ?
:
, , , .
PostgreSQL
, : , ,
, (views),
. ,
: , ,
,
.
PostgreSQL . fsync
, ,
,
,
. , ,
, ,
. no-fsync,
, ,
.
,
, fsync
30
.
MySQL ,
/,
. , MySQL -
.
,
. ,
PostgreSQL MySQL
http://openacs.org/why-not-mysql.html
, Unix
backend . Backend
. ,
backend
.
,
. ,
, .
-
, ,
. ,
, .
,
. , -
,
. ,
,
PostgreSQL .
,
. (
?.)
,
.
, ,
BSD, .
1.15) PostgreSQL?
PostgreSQL
6 .
(Marc Fournier),
.
. ,
.
, .
,
. ,
,
http://www.pgsql.com/pg_goodies .
PostgreSQL, Inc, "contributions"
PostgreSQL
- . ,
, .
_________________________________________________________________
2.1) ODBC PostgreSQL?
ODBC , PsqlODBC OpenLink ODBC.
PsqlODBC .
ftp://ftp.PostgreSQL.org/pub/odbc/.
OpenLink ODBC http://www.openlinksw.com.
,
ODBC, , ODBC PostgreSQL
(Win, Mac, Unix,
VMS).
, . ,
postgres95@openlink.co.uk.
ODBC .
2.2) PostgreSQL Web?
Web :
http://www.webreview.com
http://www.phone.net/home/mwm/hotlist/.
Web, PHP.
http://www.php.net.
, Perl CGI.pm.
2.3) PostgreSQL ?
? ?
, pgaccess,
. pgaccess
. http://www.flex.ro/pgaccess
ecpg,
SQL C.
2.4) PostgreSQL?
:
* C (libpq)
* C++ (libpq++)
* Embedded C (ecpg)
* Java (jdbc)
* Perl (perl5)
* ODBC (odbc)
* Python (PyGreSQL)
* TCL (libpgtcl)
* C Easy API (libpgeasy)
* Embedded HTML (PHP from http://www.php.net)
_________________________________________________________________
3.1) PostgreSQL /usr/local/pgsql?
--prefix configure.
3.2) postmaster, Bad System Call
core dumped. ?
, ,
- ,
System V. PostgreSQL ,
.
3.3) postmaster,
IpcMemoryCreate. ?
,
.
,
backend
postmaster. ,
, -
1 .
PostgreSQL.
3.4) postmaster,
IpcSemaphoreCreate. ?
IpcSemaphoreCreate: semget failed (No space left on
device) , .
Postgres backend .
postmaster
backend . -N
32, . -
SEMMNS SEMMNI .
.
- ,
, .
PostgreSQL.
3.5) ?
, PostgreSQL
Unix.
postmaster -i
host- $PGDATA/pg_hba.conf.
TCP/IP .
3.6) ?
, .
EXPLAIN PostgreSQL
.
INSERT,
, COPY.
, INSERT. -,
BEGIN WORK/COMMIT .
.
. ,
, .
. fsync()
postmaster -o -F. fsync(),
.
postmaster -B
, backend
. ,
postmaster
. 8
64 .
backend -S
, backend
. -S
512 (.. 512K).
CLUSTER
.
CLUSTER.
3.7) ?
PostgreSQL ,
,
.
-, configure --enable-cassert,
assert() backend
- .
postmaster, postgres . -,
postmaster, ,
:
cd /usr/local/pgsql
./bin/postmaster >server.log 2>&1 &
server.log
PostgreSQL.
, . Postmaster -d,
.
-d , .
,
.
postmaster , postgres backend
SQL .
. , ,
, .
,
, , .
backend postmaster,
/backend
.
postmaster , psql ,
PID postgres, psql.
postgres PID.
psql.
postgres, PGOPTIONS="-W n",
psql. n
, ,
.
postgres -s, -A, -t
.
PostgreSQL ,
.
backend' pgsql/data/base/dbname.
.
3.8) "Sorry, too many clients"
?
backend
postmaster.
32 .
postmaster ,
-N postgresql.conf.
, -N 32,
-B
64; -B
-N, ݣ
. backend ,
Unix.
,
, SHMMAX; , SEMMNS SEMMNI;
, NPROC;
, MAXUPRC;
, NFILE NINODE.
backend ,
.
PostgreSQL 6.5, backend
64,
MaxBackendId include/storage/sinvaladt.h.
3.9) pg_sorttempNNN.NN ?
, .
, ORDER BY
, backend
-S,
.
,
, backend .
backend ,
pg_tempNNN.NN.
_________________________________________________________________
4.1) ?
DECLARE.
4.2) SELECT ?
FETCH SELECT
... LIMIT....
,
. , ORDER BY.
- , ORDER BY, PostgreSQL
.
4.3) psql?
psql
pgsql/src/bin/psql/describe.c. SQL
psql ,
. psql -E ,
,
.
4.4) ?
ALTER TABLE DROP COLUMN, :
SELECT ... -- ,
INTO TABLE new_table
FROM old_table;
DROP TABLE old_table;
ALTER TABLE new_table RENAME TO old_table;
4.5) , ?
:
? ( 60 G
B)
? 16 TB
? 7.1
? 1 GB 7.1
?
? 250-1600
?
, ""
/.
,
.
16 TB
.
1 GB, ,
.
, 32k.
4.6)
?
PostgreSQL 5
.
, 100,000 ,
. ,
, 20 . 2.8 MB.
PostgreSQL,
6.4 MB :
36 : ()
+ 24 :
+ 4 :
----------------------------------------
64
PostgreSQL 8192 (8 KB), :
8192
------------------- = 128 ( )
64
100000
-------------------- = 782
128
782 * 8192 = 6,406,144 (6.4 MB)
,
, .
4.7) ,
?
psql , ,
. \? ,
.
pgsql/src/tutorial/syscat.source.
SELECT
.
4.8)
. ?
PostgreSQL .
VACUUM. ,
,
,
. ,
, ,
.
, VACUUM ANALYZE.
VACUUM ANALYZE
, ,
. Backend
,
VACUUM ANALYZE.
ORDER BY .
,
,
.
, LIKE ~,
- ,
. ,
, LIKE %,
~ ( ) ^.
4.9) , ?
EXPLAIN.
4.10) R-tree ?
R-tree .
. B-tree
. R-tree
. , R-tree
point,
"
."
, R-tree :
Guttman, A. "R-trees: A Dynamic Index Structure for Spatial
Searching." Proceedings of the 1984 ACM SIGMOD Int'l Conf on Mgmt of
Data, 45-57.
Stonebraker' "Readings in
Database Systems".
R-tree . ,
R-tree
. , R-tree
, , - ,
.
4.11) Genetic Query Optimizer?
GEQO ,
Genetic Algorithm (GA).
.
4.12)
?
?
~ , ~*
.
LIKE ILIKE PostgreSQL
7.1.
:
SELECT *
FROM tab
WHERE lower(col) = 'abc'
. ,
, :
CREATE INDEX tabindex on tab (lower(col));
4.13) , NULL -
?
IS NULL IS NOT NULL.
4.14) ?
--------------------------------------------------
"char" char 1
CHAR(#) bpchar
VARCHAR(#) varchar ,
TEXT text
BYTEA bytea (
null- )
,
.
"varlena" (..,
, ).
, ,
. ,
TOAST,
, .
CHAR() - ,
. VARCHAR() - ,
, . TEXT
- ,
1 . BYTEA ,
NULL .
4.15.1) serial/--?
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 UNIQUE INDEX person_id_key ON person ( id );
create_sequence.
OID . ,
, pg_dump
-o COPY WITH OIDS OID.
4.15.2) SERIAL?
SERIAL
sequence nextval()
. - 4.15.1,
Perl:
new_id = output of "SELECT nextval('person_id_seq')"
INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal');
new_id
(
person). ,
SEQUENCE <table>_<serialcolumn>_seq, table serialcolumn
SERIAL.
,
SERIAL currval()
,
INSERT INTO person (name) VALUES ('Blaise Pascal');
new_id = output of "SELECT currval('person_id_seq')";
, OID,
INSERT ,
. Perl, DBI Edmund Mergl' DBD::Pg,
oid $sth->{pg_oid_status}
$sth->execute().
4.15.3) , currval() nextval()
?
. Currval() ,
backend', .
4.15.4)
? ,
/SERIAL?
, ,
.
4.16) OID? TID?
OID PostgreSQL.
, PostgreSQL OID.
OID initdb
16384 ( backend/access/transam.h). OID
. , OID
- ,
PostgreSQL.
PostgreSQL OID
. OID
,
. OID
OID OID
.
OID
, .
OID -
OID, :
CREATE TABLE new_table(old_oid oid, mycol int);
SELECT old_oid, mycol INTO new FROM old;
COPY new TO '/tmp/pgtable';
DELETE FROM new;
COPY new WITH OIDS FROM '/tmp/pgtable';
OID 4- 4
. , , ,
.
TID
offset . TID
.
TID
.
4.17) PostgreSQL?
. :
* table, relation, class
* row, record, tuple
* column, field, attribute
* retrieve, select
* replace, update
* append, insert
* OID, serial value
* portal, cursor
* range variable, table name, table alias
http://www.comptechnews.com/~reaster/dbdesign.html
4.18) "ERROR: Memory exhausted in AllocSetAlloc()"?
7.1,
. ,
.
postmaster :
ulimit -d 262144
limit datasize 256m
shell,
,
.
,
ţ . SQL ,
backend ,
.
4.19) , PostgreSQL ?
psql, select version();
4.20) "invalid
large obj descriptor"?
BEGIN
WORK COMMIT, lo_open ...
lo_close.
PostgreSQL ,
. ,
- ,
invalid large obj descriptor,
(
)
.
ODBC,
auto-commit off.
4.21)
?
CURRENT_TIMESTAMP:
CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
4.22) , IN ?
,
. IN EXISTS:
SELECT *
FROM tab
WHERE col1 IN (SELECT col2 FROM TAB2)
:
SELECT *
FROM tab
WHERE EXISTS (SELECT col2 FROM TAB2 WHERE col1 = col2)
.
4.23) ?
PostgreSQL 7.1 ,
SQL. :
SELECT *
FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);
or
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 .
,
UNION NOT IN. , tab1
tab2, :
SELECT tab1.col1, tab2.col2
FROM tab1, tab2
WHERE tab1.col1 = tab2.col1
UNION ALL
SELECT tab1.col1, NULL
FROM tab1
WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2)
ORDER BY col1
4.24) , ?
. PostgreSQL
, ,
.
,
.
_________________________________________________________________
PostgreSQL
5.1) .
psql, dump core?
.
.
5.2)
PostgreSQL?
pgsql-hackers
contrib/.
5.3) C , ?
, .
5.4) .
?
Makefile include .
make clean make. GCC
--enable-depend configure
.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
alink="#0000ff"> alink="#0000ff">
<H1> PostgreSQL</H1> <H1> PostgreSQL</H1>
<P> : 18 17:56:04 EST 2002</P> <P> : 3 13:35:39 EST 2002</P>
<P> : (Bruce Momjian) (<A href= <P> : (Bruce Momjian) (<A href=
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR> "mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR>
...@@ -929,34 +929,36 @@ ...@@ -929,34 +929,36 @@
<H4><A name="4.8">4.8</A>) <H4><A name="4.8">4.8</A>)
. ?</H4> . ?</H4>
<P>PostgreSQL . <P> .
V<SMALL>ACUUM</SMALL>.
, , . ,
,
. , ,
, , .</P>
.</P>
<P> -
<P> , <SMALL>VACUUM , PostgreSQL .
ANALYZE.</SMALL> V<SMALL>ACUUM ANALYZE</SMALL> <SMALL>VACUUM ANALYZE</SMALL>
, <SMALL>ANALYZE</SMALL>. ,
,
. Backend , .
, .
<SMALL>VACUUM ANALYZE</SMALL>.</P>
.</P>
<P> <SMALL>ORDER BY</SMALL>
. <P> <SMALL>ORDER BY</SMALL>
, , .
, .
.</P> , <SMALL>ORDER BY</SMALL> <SMALL>LIMIT</SMALL>
,
.</P>
<P> , <SMALL>LIKE</SMALL> <P> , <SMALL>LIKE</SMALL>
<I>~</I>, <I>~</I>,
- , . - , .
, , , , ,
<SMALL>LIKE</SMALL> <I>%</I>, <I>~</I> <SMALL>LIKE</SMALL> <I>%</I>, <I>~</I>
( ) <I>^</I>.</P> ( ) <I>^</I>.</P>
<H4><A name="4.9">4.9</A>) , <H4><A name="4.9">4.9</A>) ,
?</H4> ?</H4>
...@@ -1135,7 +1137,7 @@ BYTEA bytea ...@@ -1135,7 +1137,7 @@ BYTEA bytea
<P> , , <P> , ,
. .
</P> .</P>
<H4><A name="4.16">4.16</A>) <SMALL>OID</SMALL>? <H4><A name="4.16">4.16</A>) <SMALL>OID</SMALL>?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment