提交 68d835c5 编写于 作者: B Bruce Momjian

Add Russian FAQ from Viktor Vislobokov.

上级 60555bd4
PostgreSQL
: 18 17:56:04 EST 2002
: (Bruce Momjian)
(pgman@candle.pha.pa.us)
: (victor_v@permonline.ru)
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
.
<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01 transitional//EN">
<HTML>
<!-- DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN" -->
<!-- HTML -->
<HEAD>
<META name="generator" content="HTML Tidy, see www.w3.org">
<TITLE>PostgreSQL FAQ</TITLE>
</HEAD>
<BODY bgcolor="#ffffff" text="#000000" link="#ff0000" vlink="#a00000"
alink="#0000ff">
<H1> PostgreSQL</H1>
<P> : 18 17:56:04 EST 2002</P>
<P> : (Bruce Momjian) (<A href=
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR>
</P>
<P> : (<A href=
"mailto:pgman@candle.pha.pa.us">victor_v@permonline.ru</A>)<BR>
</P>
<P> <A
href=
"http://www.postgresql.org/docs/faq-english.html">http://www.PostgreSQL.org/docs/faq-english.html</A>.</P>
<P> <A href=
"http://www.postgresql.org/users-lounge/docs/faq.html">http://www.PostgreSQL.org/users-lounge/docs/faq.html</A>.</P>
<HR>
<H2 align="center"> </H2>
<A href="#1.1">1.1</A>) PostgreSQL?
?<BR>
<A href="#1.2">1.2</A>) PostgreSQL?<BR>
<A href="#1.3">1.3</A>) Unix PostgreSQL?<BR>
<A href="#1.4">1.4</A>) Unix ?<BR>
<A href="#1.5">1.5</A>) PostgreSQL?<BR>
<A href="#1.6">1.6</A>) ?<BR>
<A href="#1.7">1.7</A>) ?<BR>
<A href="#1.8">1.8</A>) ?<BR>
<A href="#1.9">1.9</A>)
?<BR>
<A href="#1.10">1.10</A>) <SMALL>SQL</SMALL>?<BR>
<A href="#1.11">1.11</A>) PostgreSQL 2000- (Y2K)?<BR>
<A href="#1.12">1.12</A>) ?<BR>
<A href="#1.13">1.13</A>) ?<BR>
<A href="#1.14">1.14</A>) PostgreSQL
<SMALL></SMALL>?<BR>
<A href="#1.15">1.15</A>) PostgreSQL?<BR>
<H2 align="center"> </H2>
<A href="#2.1">2.1</A>) <SMALL>ODBC</SMALL>
PostgreSQL?<BR>
<A href="#2.2">2.2</A>)
PostgreSQL Web?<BR>
<A href="#2.3">2.3</A>) PostgreSQL
? ?
?<BR>
<A href="#2.4">2.4</A>)
PostgreSQL?<BR>
<H2 align="center"> </H2>
<A href="#3.1">3.1</A>) PostgreSQL
<I>/usr/local/pgsql</I>?<BR>
<A href="#3.2">3.2</A>) <I>postmaster</I>,
<I>Bad System Call</I> core dumped. ?<BR>
<A href="#3.3">3.3</A>) <I>postmaster</I>,
<I>IpcMemoryCreate</I>. ?<BR>
<A href="#3.4">3.4</A>) <I>postmaster</I>,
<I>IpcSemaphoreCreate</I>. ?<BR>
<A href="#3.5">3.5</A>)
?<BR>
<A href="#3.6">3.6</A>)
?<BR>
<A href="#3.7">3.7</A>) ?<BR>
<A href="#3.8">3.8</A>) <I>"Sorry, too many
clients"</I> ?<BR>
<A href="#3.9">3.9</A>) <I>pg_sorttempNNN.NN</I>
?<BR>
<H2 align="center"> </H2>
<A href="#4.1">4.1</A>)
?<BR>
<A href="#4.2">4.2</A>) <SMALL>SELECT</SMALL>
?<BR>
<A href="#4.3">4.3</A>)
<I>psql</I>?<BR>
<A href="#4.4">4.4</A>) ?<BR>
<A href="#4.5">4.5</A>) ,
?<BR>
<A href="#4.6">4.6</A>)
?<BR>
<A href="#4.7">4.7</A>) ,
?<BR>
<A href="#4.8">4.8</A>)
. ?<BR>
<A href="#4.9">4.9</A>) ,
?<BR>
<A href="#4.10">4.10</A>) R-tree ?<BR>
<A href="#4.11">4.11</A>) Genetic Query Optimizer?<BR>
<A href="#4.12">4.12</A>)
?
?<BR>
<A href="#4.13">4.13</A>) ,
<SMALL>NULL</SMALL> - ?<BR>
<A href="#4.14">4.14</A>)
?<BR>
<A href="#4.15.1">4.15.1</A>) serial/--?<BR>
<A href="#4.15.2">4.15.2</A>)
<SMALL>SERIAL</SMALL>?<BR>
<A href="#4.15.3">4.15.3</A>) ,
<I>currval()</I> <I>nextval()</I>
?<BR>
<A href="#4.15.4">4.15.4</A>)
?
, /SERIAL?<BR>
<A href="#4.16">4.16</A>) <SMALL>OID</SMALL>?
<SMALL>TID</SMALL>?<BR>
<A href="#4.17">4.17</A>)
PostgreSQL?<BR>
<A href="#4.18">4.18</A>) <I>"ERROR: Memory
exhausted in AllocSetAlloc()"</I>?<BR>
<A href="#4.19">4.19</A>) , PostgreSQL
?<BR>
<A href="#4.20">4.20</A>)
<I>"invalid large obj descriptor"</I>?<BR>
<A href="#4.21">4.21</A>)
?<BR>
<A href="#4.22">4.22</A>) ,
<CODE><SMALL>IN</SMALL></CODE> ?<BR>
<A href="#4.23">4.23</A>) ?<BR>
<A href="#4.24">4.24</A>) ,
?<BR>
<H2 align="center"> PostgreSQL</H2>
<A href="#5.1">5.1</A>) .
<I>psql</I>, dump core?<BR>
<A href="#5.2">5.2</A>)
PostgreSQL?<BR>
<A href="#5.3">5.3</A>) C ,
?<BR>
<A href="#5.4">5.4</A>) .
?<BR>
<HR>
<H2 align="center"> </H2>
<H4><A name="1.1">1.1</A>) PostgreSQL?</H4>
<P>PostgreSQL <I>Post-Gres-Q-L (---)</I>.</P>
<P>PostgreSQL - POSTGRES,
<SMALL></SMALL>.
PostgreSQL
POSTGRES, PostQuel
<SMALL>SQL</SMALL>. PostgreSQL -
.</P>
<P> PostgreSQL ,
Internet,
. ,
(Marc G. Fournier) (<A href=
"mailto:scrappy@PostgreSQL.org">scrappy@PostgreSQL.org</A>). (.
, ).
PostgreSQL.</P>
<P> PostgreSQL 1.01 (Andrew Yu)
(Jolly Chen).
, , .
Postgres, PostgreSQL,
,
,
(Michael Stonebraker) ,
.</P>
<P> , , Postgres.
1995 <SMALL>SQL</SMALL>,
Postgres95.
1996 PostgreSQL.</P>
<H4><A name="1.2">1.2</A>) PostgreSQL?</H4>
<P>PostgreSQL COPYRIGHT:</P>
<P> PostgreSQL</P>
<P>Portion copyright (c) 1996-2002, PostgreSQL Global Development
Group Portions Copyright (c) 1994-6 Regents of the University of
California</P>
<P> , ,
, - ,
,
.</P>
<P>
, ,
,
,
.</P>
<P>
, , :
.
" "
, , , .</P>
<P> BSD ,
.
.
ţ .</P>
<H4><A name="1.3">1.3</A>) Unix PostgreSQL?</H4>
<P>, PostgreSQL
Unix. ,
, PostgreSQL
.</P>
<H4><A name="1.4">1.4</A>) Unix
?</H4>
<P><STRONG></STRONG></P>
<P> MS Windows C
<I>libpq</I>, psql .
, MS Windows
TCP/IP , Unix
. <I>win31.mak</I> ,
<I>libpq</I>
<I>psql</I> Win32. PostgreSQL
<SMALL>ODBC</SMALL>.</P>
<P><STRONG></STRONG></P>
<P> Windows NT Win2k,
Cygwin, Unix
NT. <I>pgsql/doc/FAQ_MSWIN</I> <A href=
"http://www.postgresql.org/docs/faq-mswin.html">MS Windows FAQ</A>
. PostgreSQL
- Microsoft.</P>
<H4><A name="1.5">1.5</A>) PostgreSQL?</H4>
<P>, ftp
PostgreSQL <A href=
"ftp://ftp.PostgreSQL.org/pub">ftp://ftp.PostgreSQL.org/pub</A>.
.</P>
<H4><A name="1.6">1.6</A>) ?</H4>
<P> : <A href=
"mailto:pgsql-general@PostgreSQL.org">pgsql-general@PostgreSQL.org</A>.
, PostgreSQL.
, ,
( ) :</P>
<PRE>
subscribe
end
</PRE>
<P> <A href=
"mailto:pgsql-general-request@PostgreSQL.org">pgsql-general-request@PostgreSQL.org</A>.</P>
<P> . ,
: <A href=
"mailto:pgsql-general-digest-request@PostgreSQL.org">pgsql-general-digest-request@PostgreSQL.org</A>
:</P>
<PRE>
subscribe
end
</PRE>
,
30 .
<P> .
, <A href=
"mailto:pgsql-bugs-request@PostgreSQL.org">pgsql-bugs-request@PostgreSQL.org</A>
:</P>
<PRE>
subscribe
end
</PRE>
.
,
<A href=
"mailto:pgsql-hackers-request@PostgreSQL.org">pgsql-hackers-request@PostgreSQL.org</A>
:
<PRE>
subscribe
end
</PRE>
<P> PostgreSQL
PostgreSQL :</P>
<BLOCKQUOTE>
<A href="http://www.PostgreSQL.org">http://www.PostgreSQL.org</A>
</BLOCKQUOTE>
<P> IRC EFNet,
<I>#PostgreSQL</I>. Unix
<CODE>irc -c '#PostgreSQL' "$USER" irc.phoenix.net.</CODE></P>
<P>
<A href=
"http://www.postgresql.org/users-lounge/commercial-support.html">http://www.postgresql.org/users-lounge/commercial-support.html</A>.</P>
<H4><A name="1.7">1.7</A>) ?</H4>
<P> PostgreSQL - 7.2.</P>
<P> .</P>
<H4><A name="1.8">1.8</A>) ?</H4>
<P> ,
man .
<I>/doc</I>.
<A href=
"http://www.PostgreSQL.org/users-lounge/docs/">http://www.PostgreSQL.org/users-lounge/docs/</A>.</P>
<P> PostgreSQL <A href=
"http://www.PostgreSQL.org/docs/awbook.html">http://www.PostgreSQL.org/docs/awbook.html</A>
<a href="http://www.commandprompt.com/ppbook/">http://www.commandprompt.com/ppbook/</a>.
PostgreSQL,
<a href="http://www.postgresql.org/books/">http://www.postgresql.org/books/</a>.
, <a href="http://techdocs.postgresql.org/">http://techdocs.postgresql.org/</a>
PostgreSQL.</p>
<P><I>psql</I> \d
, , , ..</P>
<P> .</P>
<H4><A name="1.9">1.9</A>)
?</H4>
<P>PostgreSQL <SMALL>SQL</SMALL>-92.
<A href="http://developer.postgresql.org/todo.php">TODO</A>
,
.</P>
<H4><A name="1.10">1.10</A>) <SMALL>SQL</SMALL>?</H4>
<P> PostgreSQL <A href=
"http://www.PostgreSQL.org/docs/awbook.html">http://www.PostgreSQL.org/docs/awbook.html</A>
<SMALL>SQL</SMALL>. PostgreSQL
<A href="http://www.commandprompt.com/ppbook/">
http://www.commandprompt.com/ppbook.</A>
<A href=
"http://www.intermedia.net/support/sql/sqltut.shtm">http://www.intermedia.net/support/sql/sqltut.shtm,</A>
<A href=
"http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM">
http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM,</A>
<A href=
"http://sqlcourse.com/">http://sqlcourse.com.</A></P>
<P> - "Teach Yourself SQL in 21 Days, Second Edition"
( SQL 21 , )
<A href=
"http://members.tripod.com/er4ebus/sql/index.htm">http://members.tripod.com/er4ebus/sql/index.htm</A></P>
<P>
<I>The Practical SQL Handbook</I>,
Bowman, Judith S., et al., Addison-Wesley. <I>The
Complete Reference SQL</I>, Groff et al., McGraw-Hill.</P>
<H4><A name="1.11">1.11</A>) PostgreSQL 2000- (Y2K)?</H4>
<P>, 2000 2000 .</P>
<H4><A name="1.12">1.12</A>) ?</H4>
<P> ,
PostgreSQL .
, <I>pgsql-hackers</I>
<I>pgsql-patches</I>. , (patches)
pgsql-patches.</P>
<P> ,
<SMALL>CVS</SMALL> PostgreSQL.
,
, , ,
.</P>
<H4><A name="1.13">1.13</A>) ??</H4>
<P> <A href=
"http://www.postgresql.org/bugs/bugs.php">PostgreSQL BugTool</A>,
.</P>
<P> <A href=
"ftp://ftp.PostgreSQL.org/pub">ftp://ftp.PostgreSQL.org/pub</A>
PostgreSQL .</P>
<H4><A name="1.14">1.14</A>) PostgreSQL
<SMALL></SMALL>?</H4>
<P>
:
, , , .</P>
<DL>
<DT><B></B></DT>
<DD>PostgreSQL
<SMALL></SMALL>, : ,
, , (views),
. ,
: , ,
,
.<BR>
<BR>
</DD>
<DT><B></B></DT>
<DD>PostgreSQL . <I>fsync</I>
, ,
,
,
. , ,
, ,
.
<I>no-fsync</I>, ,
,
.
, ,
<I>fsync</I>
30 .<BR>
<BR>
MySQL ,
/, . ,
MySQL -
<I></I>.
,
.
, PostgreSQL MySQL <A href=
"http://openacs.org/why-not-mysql.html">http://openacs.org/why-not-mysql.html</A><BR>
<BR>
,
Unix backend . Backend
. ,
backend .<BR>
<BR>
</DD>
<DT><B></B></DT>
<DD> , <SMALL></SMALL>
. ,
, .
-
, ,
. , ,
.<BR>
<BR>
</DD>
<DT><B></B></DT>
<DD>
,
. , - ,
<SMALL></SMALL>
. , ,
PostgreSQL
<SMALL></SMALL>.
,
. ( <A href="#1.6"> ?</A>.)<BR>
<BR>
</DD>
<DT><B></B></DT>
<DD> ,
.
, ,
BSD, .<BR>
<BR>
</DD>
</DL>
<H4><A name="1.15">1.15</A>)
PostgreSQL?</H4>
<P>PostgreSQL
6 .
(Marc Fournier),
.</P>
<P>
. ,
.</P>
<P>, .
,
. ,
,
<A href=
"http://www.pgsql.com/pg_goodies">http://www.pgsql.com/pg_goodies</A>
.</P>
<P> PostgreSQL, Inc,
"contributions"
PostgreSQL - .
, , .</P>
<HR>
<H2 align="center"> </H2>
<H4><A name="2.1">2.1</A>) <SMALL>ODBC</SMALL>
PostgreSQL?</H4>
<P> <SMALL>ODBC</SMALL> , PsqlODBC
OpenLink <SMALL>ODBC</SMALL>.</P>
<P>PsqlODBC .
<A href=
"ftp://ftp.PostgreSQL.org/pub/odbc/">ftp://ftp.PostgreSQL.org/pub/odbc/</A>.</P>
<P>OpenLink <SMALL>ODBC</SMALL> <A href=
"http://www.openlinksw.com/">http://www.openlinksw.com</A>.
,
<SMALL>ODBC</SMALL>, , <SMALL>ODBC</SMALL>
PostgreSQL
(Win, Mac, Unix, VMS).</P>
<P>
, . ,
<A href=
"mailto:postgres95@openlink.co.uk">postgres95@openlink.co.uk</A>.</P>
<P> <A href=
"http://www.postgresql.org/devel-corner/docs/programmer/odbc.html">ODBC
</A>.</P>
<H4><A name="2.2">2.2</A>)
PostgreSQL Web?</H4>
<P> Web :
<A href="http://www.webreview.com">http://www.webreview.com</A></P>
<P> <A href=
"http://www.phone.net/home/mwm/hotlist/">http://www.phone.net/home/mwm/hotlist/.</A></P>
<P> Web, PHP.
<A
href="http://www.php.net">http://www.php.net</A>.</P>
<P> , Perl CGI.pm.</P>
<H4><A name="2.3">2.3</A>) PostgreSQL
? ?
?</H4>
<P> ,
<I>pgaccess</I>, . <I>pgaccess</I>
. <A href=
"http://www.flex.ro/pgaccess">http://www.flex.ro/pgaccess</A></P>
<P> <I>ecpg</I>,
SQL C.</P>
<H4><A name="2.4">2.4</A>)
PostgreSQL?</H4>
<P> :</P>
<UL>
<LI>C (libpq)</LI>
<LI>C++ (libpq++)</LI>
<LI>Embedded C (ecpg)</LI>
<LI>Java (jdbc)</LI>
<LI>Perl (perl5)</LI>
<LI>ODBC (odbc)</LI>
<LI>Python (PyGreSQL)</LI>
<LI>TCL (libpgtcl)</LI>
<LI>C Easy API (libpgeasy)</LI>
<LI>Embedded <SMALL>HTML</SMALL> (<A href=
"http://www.php.net">PHP from http://www.php.net</A>)</LI>
</UL>
<HR>
<H2 align="center"> </H2>
<H4><A name="3.1">3.1</A>) PostgreSQL
<I>/usr/local/pgsql</I>?</H4>
<P> <I>--prefix</I> <I>configure</I>.</P>
<H4><A name="3.2">3.2</A>) <I>postmaster</I>,
<I>Bad System Call</I> core dumped. ?</H4>
<P> , ,
- ,
System V. PostgreSQL ,
.</P>
<H4><A name="3.3">3.3</A>) <I>postmaster</I>,
<I>IpcMemoryCreate</I>. ?</H4>
<P> ,
.
,
backend
<I>postmaster</I>. ,
, -
1 .
<A href=
"http://www.postgresql.org/idocs/index.php?kernel-resources.html">
PostgreSQL</A>.</P>
<H4><A name="3.4">3.4</A>) <I>postmaster</I>,
<I>IpcSemaphoreCreate</I>. ?</H4>
<P> <I>IpcSemaphoreCreate: semget failed (No
space left on device)</I> ,
. Postgres
backend . <I>postmaster</I>
backend .
<I>-N</I> 32, .
- <SMALL>SEMMNS</SMALL>
<SMALL>SEMMNI</SMALL> .</P>
<P>
.</P>
<P> - ,
, .
PostgreSQL.</P>
<H4><A name="3.5">3.5</A>)
?</H4>
<P> , PostgreSQL
Unix.
<I>postmaster</I> <I>-i</I>
<B></B> host-
<I>$PGDATA/pg_hba.conf</I>. TCP/IP
.</P>
<H4><A name="3.6">3.6</A>)
?</H4>
<P>, .
<SMALL>EXPLAIN</SMALL> PostgreSQL
.</P>
<P> <SMALL>INSERT</SMALL>,
,
<SMALL>COPY</SMALL>. ,
<SMALL>INSERT.</SMALL> -,
<SMALL>BEGIN WORK/COMMIT</SMALL> .
.
. ,
,
.</P>
<P> .
<I>fsync()</I> <I>postmaster</I> <I>-o -F</I>.
<I>fsync()</I>,
.</P>
<P> <I>postmaster</I> <I>-B</I>
,
backend .
, <I>postmaster</I>
.
8 64 .</P>
<P> backend <I>-S</I>
, backend
. <I>-S</I>
512 (.. 512K).</P>
<P> <SMALL>CLUSTER</SMALL>
.
<SMALL>CLUSTER</SMALL>.</P>
<H4><A name="3.7">3.7</A>)
?</H4>
<P>PostgreSQL ,
,
.</P>
<P>-, <I>configure</I> --enable-cassert,
<I>assert()</I> backend
-
.</P>
<P> <I>postmaster</I>, <I>postgres</I>
. -, <I>postmaster</I>, ,
:</P>
<PRE>
cd /usr/local/pgsql
./bin/postmaster &gt;server.log 2&gt;&amp;1 &amp;
</PRE>
<P> server.log
PostgreSQL.
, . <I>Postmaster</I> <I>-d</I>,
. <I>-d</I> ,
. ,
.</P>
<P> <I>postmaster</I> ,
<I>postgres</I> backend
<SMALL>SQL</SMALL> . <B></B>
. , ,
, .
, ,
, . backend
<I>postmaster</I>,
/backend .</P>
<P> <I>postmaster</I> , <I>psql</I>
, <SMALL>PID</SMALL> <I>postgres</I>,
<I>psql</I>.
<I>postgres</I> <SMALL>PID.</SMALL>
<I>psql</I>.
<I>postgres</I>,
PGOPTIONS="-W n", <I>psql</I>.
<I>n</I> ,
,
.</P>
<P> <I>postgres</I> <I>-s, -A</I>, <I>-t</I>
.</P>
<P> PostgreSQL
, .
backend'
<I>pgsql/data/base/dbname</I>.
.</P>
<H4><A name="3.8">3.8</A>) <I>"Sorry, too
many clients"</I> ?</H4>
<P>
backend <I>postmaster</I>.</P>
<P> 32 .
<I>postmaster</I>
, <I>-N</I>
<I>postgresql.conf</I>.</P>
<P>, <I>-N</I>
32, <I>-B</I>
64; <I>-B</I>
<I>-N</I>,
ݣ .
backend ,
Unix. ,
, <SMALL>SHMMAX;</SMALL>
, <SMALL>SEMMNS</SMALL> <SMALL>SEMMNI;</SMALL>
, <SMALL>NPROC;</SMALL>
, <SMALL>MAXUPRC;</SMALL>
, <SMALL>NFILE</SMALL> <SMALL>NINODE.</SMALL>
backend
, .</P>
<P> PostgreSQL 6.5, backend
64,
MaxBackendId <I>include/storage/sinvaladt.h</I>.</P>
<H4><A name="3.9">3.9</A>) <I>pg_sorttempNNN.NN</I>
?</H4>
<P> , .
, <SMALL>ORDER BY</SMALL>
,
backend <I>-S</I>,
.</P>
<P> ,
, backend .
backend ,
pg_tempNNN.NN.</P>
<HR>
<H2 align="center"> </H2>
<H4><A name="4.1">4.1</A>)
?</H4>
<P>
<SMALL>DECLARE</SMALL>.</P>
<H4><A name="4.2">4.2</A>) <SMALL>SELECT</SMALL>
?</H4>
<P> <SMALL>FETCH</SMALL>
<SMALL>SELECT</SMALL> ... <SMALL>LIMIT</SMALL>....</P>
<P> ,
. ,
<SMALL>ORDER BY.</SMALL> - ,
<SMALL>ORDER BY</SMALL>, PostgreSQL
.</P>
<H4><A name="4.3">4.3</A>)
<I>psql</I>?</H4>
<P> <I>psql</I>
<I>pgsql/src/bin/psql/describe.c</I>.
<SMALL>SQL</SMALL> psql ,
.
<I>psql</I> <I>-E</I> ,
,
.</P>
<H4><A name="4.4">4.4</A>) ?</H4>
<P> <SMALL>ALTER TABLE DROP COLUMN,</SMALL>
:</P>
<PRE>
SELECT ... -- ,
INTO TABLE new_table
FROM old_table;
DROP TABLE old_table;
ALTER TABLE new_table RENAME TO old_table;
</PRE>
<H4><A name="4.5">4.5</A>) ,
?</H4>
<P> :</P>
<PRE>
? ( 60 GB)
? 16 TB
? 7.1
? 1 GB 7.1
?
? 250-1600
?
</PRE>
, ""
/.
,
.
<P> 16 TB
.
1 GB, ,
.</P>
<P>
,
32k.</P>
<H4><A name="4.6">4.6</A>)
?</H4>
<P> PostgreSQL 5
.</P>
<P> , 100,000 ,
. ,
, 20 . 2.8 MB.
PostgreSQL,
6.4 MB :</P>
<PRE>
36 : ()
+ 24 :
+ 4 :
----------------------------------------
64
PostgreSQL 8192 (8 KB), :
8192
------------------- = 128 ( )
64
100000
-------------------- = 782
128
782 * 8192 = 6,406,144 (6.4 MB)
</PRE>
<P> ,
, .</P>
<H4><A name="4.7">4.7</A>) ,
?</H4>
<P><I>psql</I> ,
, .
\? , .</P>
<P> <I>pgsql/src/tutorial/syscat.source</I>.
<SMALL>SELECT</SMALL>
.</P>
<H4><A name="4.8">4.8</A>)
. ?</H4>
<P>PostgreSQL .
V<SMALL>ACUUM</SMALL>.
, ,
,
. ,
, ,
.</P>
<P> , <SMALL>VACUUM
ANALYZE.</SMALL> V<SMALL>ACUUM ANALYZE</SMALL>
,
,
. Backend
,
<SMALL>VACUUM ANALYZE</SMALL>.</P>
<P> <SMALL>ORDER BY</SMALL>
.
, ,
.</P>
<P> , <SMALL>LIKE</SMALL>
<I>~</I>,
- , .
, ,
<SMALL>LIKE</SMALL> <I>%</I>, <I>~</I>
( ) <I>^</I>.</P>
<H4><A name="4.9">4.9</A>) ,
?</H4>
<P> <SMALL>EXPLAIN</SMALL>.</P>
<H4><A name="4.10">4.10</A>) R-tree ?</H4>
<P>R-tree .
. B-tree
. R-tree
. , R-tree
<I>point</I>,
"
."</P>
<P> , R-tree
:</P>
<P>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.</P>
<P> Stonebraker' "Readings in
Database Systems".</P>
<P> R-tree . ,
R-tree
. , R-tree
, , - ,
.</P>
<H4><A name="4.11">4.11</A>) Genetic Query
Optimizer?</H4>
<P> <SMALL>GEQO</SMALL> ,
Genetic Algorithm (GA).
.</P>
<H4><A name="4.12">4.12</A>)
?
?</H4>
<P> <I>~</I> ,
<I>~*</I>
. <SMALL>LIKE</SMALL>
<SMALL>ILIKE</SMALL> PostgreSQL 7.1.</P>
<P> :</P>
<PRE>
SELECT *
FROM tab
WHERE lower(col) = 'abc'
</PRE>
. ,
, :
<PRE>
CREATE INDEX tabindex on tab (lower(col));
</PRE>
<H4><A name="4.13">4.13</A>) ,
<SMALL>NULL</SMALL> - ?</H4>
<P> <SMALL>IS NULL</SMALL>
<SMALL>IS NOT NULL</SMALL>.</P>
<H4><A name="4.14">4.14</A>)
?</H4>
<PRE>
--------------------------------------------------
"char" char 1
CHAR(#) bpchar
VARCHAR(#) varchar ,
TEXT text
BYTEA bytea ( null- )
</PRE>
<P> ,
.</P>
<P> "varlena" (..,
, ).
, ,
. ,
<SMALL>TOAST</SMALL>,
,
.</P>
<P><SMALL>CHAR()</SMALL> - ,
. <SMALL>VARCHAR()</SMALL> -
, ,
. <SMALL>TEXT</SMALL> -
, 1 .
<SMALL>BYTEA</SMALL> ,
<SMALL>NULL</SMALL> .</P>
<H4><A name="4.15.1">4.15.1</A>)
serial/--?</H4>
<P>PostgreSQL <SMALL>SERIAL</SMALL>.
.
:</P>
<PRE>
CREATE TABLE person (
id SERIAL,
name TEXT
);
</PRE>
:
<PRE>
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 );
</PRE>
<I>create_sequence</I>.
<I>OID</I> . ,
,
<I>pg_dump</I> <I>-o</I>
<SMALL>COPY WITH OIDS</SMALL>
<SMALL>OID</SMALL>.
<H4><A name="4.15.2">4.15.2</A>)
<SMALL>SERIAL</SMALL>?</H4>
<P>
<SMALL>SERIAL</SMALL> sequence
<I>nextval()</I> <I></I>
. - <A href="#4.15.1">4.15.1</A>,
Perl:</P>
<PRE>
new_id = output of "SELECT nextval('person_id_seq')"
INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal');
</PRE>
<CODE>new_id</CODE> (
<CODE>person</CODE>). ,
<SMALL>SEQUENCE</SMALL>
&lt;<I>table</I>&gt;_&lt;<I>serialcolumn</I>&gt;_<I>seq</I>,
<I>table</I> <I>serialcolumn</I>
<SMALL>SERIAL</SMALL>.
<P> ,
<SMALL>SERIAL</SMALL> <I>currval</I>()
<I></I> , </P>
<PRE>
INSERT INTO person (name) VALUES ('Blaise Pascal');
new_id = output of "SELECT currval('person_id_seq')";
</PRE>
,
<A href="#4.16"><SMALL>OID</SMALL></A>,
<SMALL>INSERT</SMALL> ,
. Perl, DBI Edmund Mergl' DBD::Pg,
oid <I>$sth-&gt;{pg_oid_status}</I>
<I>$sth-&gt;execute()</I>.
<H4><A name="4.15.3">4.15.3</A>) ,
<I>currval()</I> <I>nextval()</I>
?</H4>
<P>. Currval() ,
backend', .</P>
<H4><A name="4.15.4">4.15.4</A>)
?
, /SERIAL?</H4>
<P> , ,
.
</P>
<H4><A name="4.16">4.16</A>) <SMALL>OID</SMALL>?
<SMALL>TID</SMALL>?</H4>
<P> <SMALL>OID</SMALL>
PostgreSQL. , PostgreSQL
<SMALL>OID</SMALL>. <SMALL>OID</SMALL>
<I>initdb</I> 16384 (
<I>backend/access/transam.h</I>).
<SMALL>OID</SMALL> . ,
<SMALL>OID</SMALL> -
, PostgreSQL.</P>
<P>PostgreSQL <SMALL>OID</SMALL>
. <SMALL>OID</SMALL>
,
.
<SMALL>OID</SMALL> <SMALL>OID</SMALL>
<SMALL>OID</SMALL>
.</P>
<P> <SMALL>OID</SMALL>
, .
<SMALL>OID</SMALL> -
<SMALL>OID</SMALL>, :</P>
<PRE>
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';
<!--
CREATE TABLE new_table (mycol int);
INSERT INTO new_table (oid, mycol) SELECT oid, mycol FROM old_table;
-->
</PRE>
<P><SMALL>OID</SMALL> 4-
4 . , ,
,
.</P>
<P>T<SMALL>ID</SMALL>
offset . T<SMALL>ID</SMALL>
.
<P>T<SMALL>ID</SMALL>
.</P>
<H4><A name="4.17">4.17</A>)
PostgreSQL?</H4>
<P>
. :</P>
<UL>
<LI>table, relation, class</LI>
<LI>row, record, tuple</LI>
<LI>column, field, attribute</LI>
<LI>retrieve, select</LI>
<LI>replace, update</LI>
<LI>append, insert</LI>
<LI><SMALL>OID</SMALL>, serial value</LI>
<LI>portal, cursor</LI>
<LI>range variable, table name, table alias</LI>
</UL>
<P> <A href=
"http://www.comptechnews.com/~reaster/dbdesign.html">http://www.comptechnews.com/~reaster/dbdesign.html</A></P>
<H4><A name="4.18">4.18</A>) <I>"ERROR: Memory
exhausted in AllocSetAlloc()"</I>?</H4>
<P> 7.1,
. ,
.
<I>postmaster</I>
:</P>
<PRE>
ulimit -d 262144
limit datasize 256m
</PRE>
shell,
,
.
,
ţ . <SMALL>SQL</SMALL>
, backend ,
.
<H4><A name="4.19">4.19</A>) , PostgreSQL
?</H4>
<P> <I>psql</I>, <CODE>select version();</CODE></P>
<H4><A name="4.20">4.20</A>)
<I>"invalid large obj descriptor"</I>?</H4>
<P>
<CODE>BEGIN WORK</CODE> <CODE>COMMIT</CODE>,
<CODE>lo_open</CODE> ... <CODE>lo_close.</CODE></P>
<P> PostgreSQL ,
. ,
- ,
<I>invalid large obj descriptor</I>,
(
)
.</P>
<P> <SMALL>ODBC</SMALL>,
<CODE>auto-commit off.</CODE></P>
<H4><A name="4.21">4.21</A>)
?</H4>
<P> <I>CURRENT_TIMESTAMP</I>:</P>
<PRE>
<CODE>CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
</CODE>
</PRE>
<H4><A name="4.22">4.22</A>) ,
<CODE><SMALL>IN</SMALL></CODE> ?</H4>
<P> ,
. <CODE>IN</CODE>
<CODE>EXISTS</CODE>:</P>
<PRE>
<CODE>SELECT *
FROM tab
WHERE col1 IN (SELECT col2 FROM TAB2)
</CODE>
</PRE>
:
<PRE>
<CODE>SELECT *
FROM tab
WHERE EXISTS (SELECT col2 FROM TAB2 WHERE col1 = col2)
</CODE>
</PRE>
.
<H4><A name="4.23">4.23</A>) ?</H4>
<P>PostgreSQL 7.1 ,
SQL. :</P>
<PRE>
SELECT *
FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);
</PRE>
or
<PRE>
SELECT *
FROM t1 LEFT OUTER JOIN t2 USING (col);
</PRE>
<P> t1.col t2.col,
t1 ( t2).
<SMALL>RIGHT</SMALL>
t2. <SMALL>FULL</SMALL>
t1 t2. <SMALL>OUTER</SMALL>
<SMALL>LEFT</SMALL>,
<SMALL>RIGHT</SMALL> <SMALL>FULL</SMALL> .
<SMALL>INNER</SMALL> .</P>
<P> ,
<SMALL>UNION</SMALL> <SMALL>NOT IN</SMALL>. ,
<I>tab1</I> <I>tab2</I>,
<I></I> :<BR>
<BR>
</P>
<PRE>
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
</PRE>
<H4><A name="4.24">4.24</A>) ,
?</H4>
<P> .
PostgreSQL
, , .</P>
<P>,
.</P>
<HR>
<H2 align="center"> PostgreSQL</H2>
<H4><A name="5.1">5.1</A>) .
<I>psql</I>, dump core?</H4>
<P> .
.</P>
<H4><A name="5.2">5.2</A>)
PostgreSQL?</H4>
<P> <I>pgsql-hackers</I>
<I>contrib/</I>.</P>
<H4><A name="5.3">5.3</A>) C ,
?</H4>
<P>
, .</P>
<H4><A name="5.4">5.4</A>) .
?</H4>
<P> <I>Makefile</I> include
. <I>make clean</I> <I>make</I>.
<SMALL>GCC</SMALL>
<I>--enable-depend</I> <I>configure</I>
.</P>
</BODY>
</HTML>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册