1010alink ="#0000ff ">
1111< H1 > Frequently Asked Questions (FAQ) for PostgreSQL</ H1 >
1212
13- < P > Last updated: Sat Nov 2700:14:59 EST 2004</ P >
13+ < P > Last updated: Sat Nov 2723:55:37 EST 2004</ P >
1414
1515< P > Current maintainer: Bruce Momjian (< A href =
1616 "mailto:pgman@candle.pha.pa.us "> pgman@candle.pha.pa.us</ A > )< BR >
@@ -111,8 +111,8 @@ <H2 align="center">Operational Questions</H2>
111111 serial/auto-incrementing field?< BR >
112112< A href ="#4.15.2 "> 4.15.2</ A > ) How do I get the value of a
113113< SMALL > SERIAL</ SMALL > insert?< BR >
114- < A href ="#4.15.3 "> 4.15.3</ A > )Don 't< I > currval()</ I > and
115- < I > nextval() </ I > lead to a race condition with other users?< BR >
114+ < A href ="#4.15.3 "> 4.15.3</ A > )Doesn 't< I > currval()</ I >
115+ lead to a race condition with other users?< BR >
116116< A href ="#4.15.4 "> 4.15.4</ A > ) Why aren't my sequence numbers
117117 reused on transaction abort? Why are there gaps in the numbering of
118118 my sequence/SERIAL column?< BR >
@@ -395,10 +395,9 @@ <H4><A name="1.12">1.12</A>) How do I join the development
395395
396396< H4 > < A name ="1.13 "> 1.13</ A > ) How do I submit a bug report?</ H4 >
397397
398- < P > Please visit the PostgreSQL BugTool page at< A href =
399- "http://www.PostgreSQL.org/bugs/bugs.php "> http://www.PostgreSQL.org/bugs/bugs.php</ A > ,
400- which gives guidelines and directions on how to submit a
401- bug report.</ P >
398+ < P > Visit the PostgreSQL bug form at< A href =
399+ "http://www.postgresql.org/bugform.html ">
400+ http://www.postgresql.org/bugform.html</ A > .</ P >
402401
403402< P > Also check out our ftp site< A href =
404403 "ftp://ftp.PostgreSQL.org/pub "> ftp://ftp.PostgreSQL.org/pub</ A > to
@@ -546,7 +545,9 @@ <H4><A name="2.3">2.3</A>) Does PostgreSQL have a graphical user
546545 http://www.pgaccess.org</ a > ), PgAdmin III (< a
547546href ="http://www.pgadmin.org "> http://www.pgadmin.org</ a > , RHDB Admin (< a
548547href ="http://sources.redhat.com/rhdb/ "> http://sources.redhat.com/rhdb/
549- </ a > ) and Rekall (< a href ="http://www.thekompany.com/products/rekall/ ">
548+ </ a > ), TORA (< a href ="http://www.globecom.net/tora/ "> http://www.globecom.net/tora/
549+ (partly commercial)</ a > , and Rekall
550+ (< a href ="http://www.thekompany.com/products/rekall/ ">
550551 http://www.thekompany.com/products/rekall/</ a > , proprietary). There is
551552 also PhpPgAdmin (< a href ="http://phppgadmin.sourceforge.net/ ">
552553 http://phppgadmin.sourceforge.net/</ a > ), a web-based interface to
@@ -606,10 +607,9 @@ <H4><A name="3.3">3.3</A>) When I try to start <I>postmaster</I>, I
606607 how many buffers and backend processes you configure for
607608< I > postmaster</ I > . For most systems, with default numbers of
608609 buffers and processes, you need a minimum of ~1 MB. See the< A
609- href =
610- "http://www.PostgreSQL.org/docs/view.php?version=current&idoc=1&file=kernel-resources.html "> PostgreSQL
611- Administrator's Guide</ A > for more detailed information about
612- shared memory and semaphores.</ P >
610+ href ="http://www.postgresql.org/docs/current/static/kernel-resources.html "> PostgreSQL
611+ Administrator's Guide/Server Run-time Environment/Managing Kernel Resources</ A >
612+ section for more detailed information about shared memory and semaphores.</ P >
613613
614614< H4 > < A name ="3.4 "> 3.4</ A > ) When I try to start< I > postmaster</ I > , I
615615 get< I > IpcSemaphoreCreate</ I > errors. Why?</ H4 >
@@ -645,8 +645,9 @@ <H4><A name="3.6">3.6</A>) How do I tune the database engine for
645645 better performance?</ H4 >
646646
647647< P > Certainly, indexes can speed up queries. The
648- < SMALL > EXPLAIN ANALYZE</ SMALL > command allows you to see how PostgreSQL is
649- interpreting your query, and which indexes are being used.</ P >
648+ < SMALL > EXPLAIN ANALYZE</ SMALL > command allows you to see how
649+ PostgreSQL is interpreting your query, and which indexes are
650+ being used.</ P >
650651
651652< P > If you are doing many< SMALL > INSERTs</ SMALL > , consider doing
652653 them in a large batch using the< SMALL > COPY</ SMALL > command. This
@@ -657,22 +658,23 @@ <H4><A name="3.6">3.6</A>) How do I tune the database engine for
657658 reduces the transaction overhead. Also, consider dropping and
658659 recreating indexes when making large data changes.</ P >
659660
660- < P > There are several tuning options. You can disable< I > fsync()</ I >
661- by starting< I > postmaster</ I > with a< I > -o -F</ I > option. This will
661+ < P > There are several tuning options in the< a href =
662+ "http://www.postgresql.org/docs/current/static/runtime.html ">
663+ Administration Guide/Server Run-time Environment/Run-time Configuration</ a > .
664+ You can disable< I > fsync()</ I > by using< i > fsync</ I > option. This will
662665 prevent< I > fsync()</ I > s from flushing to disk after every
663666 transaction.</ P >
664667
665- < P > You canalso use the< I > postmaster </ I > < I > -B </ I > option to
668+ < P > You can use the< I > shared_buffers </ I > option to
666669 increase the number of shared memory buffers used by the backend
667670 processes. If you make this parameter too high, the
668671< I > postmaster</ I > may not start because you have exceeded your
669672 kernel's limit on shared memory space. Each buffer is 8K and the
670- default is64 buffers.</ P >
673+ default is1000 buffers.</ P >
671674
672- < P > You can also use the backend< I > -S</ I > option to increase the
673- maximum amount of memory used by the backend process for temporary
674- sorts. The< I > -S</ I > value is measured in kilobytes, and the
675- default is 512 (i.e. 512K).</ P >
675+ < P > You can also use the< I > sort_mem</ I > and< I > work_mem</ I > options
676+ to increase the maximum amount of memory used by the backend processes
677+ for each temporary sort. The default is 1024 (i.e. 1MB).</ P >
676678
677679< P > You can also use the< SMALL > CLUSTER</ SMALL > command to group
678680 data in tables to match an index. See the< SMALL > CLUSTER</ SMALL >
@@ -717,17 +719,18 @@ <H4><A name="3.7">3.7</A>) What debugging features are
717719
718720< P > If< I > postmaster</ I > is running, start< I > psql</ I > in one
719721 window, then find the< SMALL > PID</ SMALL > of the< I > postgres</ I >
720- process used by< I > psql</ I > . Use a debugger to attach to the
721- < I > postgres</ I > < SMALL > PID</ SMALL > . You can set breakpoints in the
722- debugger and issue queries from< I > psql</ I > . If you are debugging
723- < I > postgres</ I > startup, you can set PGOPTIONS="-W n", then start
724- < I > psql</ I > . This will cause startup to delay for< I > n</ I > seconds
725- so you can attach to the process with the debugger, set any
726- breakpoints, and continue through the startup sequence.</ P >
727-
728- < P > The< I > postgres</ I > program has< I > -s, -A</ I > , and< I > -t</ I >
729- options that can be very useful for debugging and performance
730- measurements.</ P >
722+ process used by< I > psql</ I > using< pre > SELECT pg_backend_pid()</ pre > .
723+ Use a debugger to attach to the< I > postgres</ I > < SMALL > PID</ SMALL > .
724+ You can set breakpoints in the debugger and issue queries from
725+ < I > psql</ I > . If you are debugging< I > postgres</ I > startup, you can
726+ set PGOPTIONS="-W n", then start< I > psql</ I > . This will cause startup
727+ to delay for< I > n</ I > seconds so you can attach to the process with
728+ the debugger, set any breakpoints, and continue through the startup
729+ sequence.</ P >
730+
731+ < P > There are several< pre > log_*</ pre > server configuration variables
732+ that enable printing of process statistics which can be very useful
733+ for debugging and performance measurements.</ P >
731734
732735< P > You can also compile with profiling to see what functions are
733736 taking execution time. The backend profile files will be deposited
@@ -947,7 +950,8 @@ <H4><A name="4.7">4.7</A>) How do I find out what tables, indexes,
947950
948951< H4 > < A name ="4.8 "> 4.8</ A > ) My queries are slow or don't make use of
949952 the indexes. Why?</ H4 >
950- Indexes are not automatically used by every query. Indexes are only
953+
954+ < P > Indexes are not automatically used by every query. Indexes are only
951955 used if the table is larger than a minimum size, and the query
952956 selects only a small percentage of the rows in the table. This is
953957 because the random disk access caused by an index scan can be
@@ -997,7 +1001,11 @@ <H4><A name="4.8">4.8</A>) My queries are slow or don't make use of
9971001< I > ~*</ I > do not utilise indexes. Instead, use functional
9981002 indexes, which are described in section< a href ="#4.12 "> 4.12</ a > .</ LI >
9991003< LI > The default< I > C</ I > locale must be used during
1000- < i > initdb</ i > .</ LI >
1004+ < i > initdb</ i > because it is not possible to know the next-greater
1005+ character in a non-C locale. You can create a special
1006+ < PRE > text_pattern_ops</ PRE > index for such cases that work only
1007+ for< PRE > LIKE</ PRE > indexing.
1008+ </ LI >
10011009</ UL >
10021010< P >
10031011
@@ -1169,8 +1177,8 @@ <H4><A name="4.15.2">4.15.2</A>) How do I get the value of a
11691177 value is made available via< I > $sth->{pg_oid_status}</ I > after
11701178< I > $sth->execute()</ I > .
11711179
1172- < H4 > < A name ="4.15.3 "> 4.15.3</ A > )Don 't< I > currval()</ I > and
1173- < I > nextval() </ I > lead to a race condition with other users?</ H4 >
1180+ < H4 > < A name ="4.15.3 "> 4.15.3</ A > )Doesn 't< I > currval()</ I >
1181+ lead to a race condition with other users?</ H4 >
11741182
11751183< P > No.< I > currval()</ I > returns the current value assigned by your
11761184 backend, not by all users.</ P >