1414alink ="#0000ff ">
1515< H1 > Frequently Asked Questions (FAQ) for PostgreSQL</ H1 >
1616
17- < P > Last updated:Tue Feb12 12:18:09 EST 2002</ P >
17+ < P > Last updated:Thu Feb14 12:14:47 EST 2002</ P >
1818
1919< P > Current maintainer: Bruce Momjian (< A href =
2020 "mailto:pgman@candle.pha.pa.us "> pgman@candle.pha.pa.us</ A > )< BR >
@@ -72,16 +72,13 @@ <H2 align="center">Administrative Questions</H2>
7272 get< I > IpcMemoryCreate</ I > errors. Why?< BR >
7373< A href ="#3.4 "> 3.4</ A > ) When I try to start< I > postmaster</ I > , I
7474 get< I > IpcSemaphoreCreate</ I > errors. Why?< BR >
75- < A href ="#3.5 "> 3.5</ A > ) How do I prevent other hosts from
76- accessing my PostgreSQL database?< BR >
77- < A href ="#3.6 "> 3.6</ A > ) Why can't I connect to my database from
78- another machine?< BR >
79- < A href ="#3.7 "> 3.7</ A > ) How do I tune the database engine for
75+ < A href ="#3.5 "> 3.5</ A > ) How do I control connections from other hosts?< BR >
76+ < A href ="#3.6 "> 3.6</ A > ) How do I tune the database engine for
8077 better performance?< BR >
81- < A href ="#3.8 "> 3.8 </ A > ) What debugging features are available?< BR >
82- < A href ="#3.9 "> 3.9 </ A > ) Why do I get< I > "Sorry, too many
78+ < A href ="#3.7 "> 3.7 </ A > ) What debugging features are available?< BR >
79+ < A href ="#3.8 "> 3.8 </ A > ) Why do I get< I > "Sorry, too many
8380 clients"</ I > when trying to connect?< BR >
84- < A href ="#3.10 "> 3.10 </ A > ) What are the< I > pg_sorttempNNN.NN</ I >
81+ < A href ="#3.9 "> 3.9 </ A > ) What are the< I > pg_sorttempNNN.NN</ I >
8582 files in my database directory?< BR >
8683
8784
@@ -633,8 +630,8 @@ <H4><A name="3.4">3.4</A>) When I try to start <I>postmaster</I>, I
633630 PostgreSQL Administrator's Guide for more detailed information
634631 about shared memory and semaphores.</ P >
635632
636- < H4 > < A name ="3.5 "> 3.5</ A > ) How do Iprevent other hosts from
637- accessing my PostgreSQL database ?</ H4 >
633+ < H4 > < A name ="3.5 "> 3.5</ A > ) How do Icontrol connections from other
634+ hosts ?</ H4 >
638635
639636< P > By default, PostgreSQL only allows connections from the local
640637 machine using Unix domain sockets. Other machines will not be able
@@ -643,16 +640,7 @@ <H4><A name="3.5">3.5</A>) How do I prevent other hosts from
643640< I > $PGDATA/pg_hba.conf</ I > accordingly. This will allow TCP/IP
644641 connections.</ P >
645642
646- < H4 > < A name ="3.6 "> 3.6</ A > ) Why can't I connect to my database from
647- another machine?</ H4 >
648-
649- < P > The default configuration allows only Unix domain socket
650- connections from the local machine. To enable TCP/IP connections,
651- make sure< I > postmaster</ I > has been started with the< I > -i</ I >
652- option, and add an appropriate host entry to the file
653- < I > pgsql/data/pg_hba.conf</ I > .</ P >
654-
655- < H4 > < A name ="3.7 "> 3.7</ A > ) How do I tune the database engine for
643+ < H4 > < A name ="3.6 "> 3.6</ A > ) How do I tune the database engine for
656644 better performance?</ H4 >
657645
658646< P > Certainly, indexes can speed up queries. The
@@ -689,7 +677,7 @@ <H4><A name="3.7">3.7</A>) How do I tune the database engine for
689677 data in tables to match an index. See the< SMALL > CLUSTER</ SMALL >
690678 manual page for more details.</ P >
691679
692- < H4 > < A name ="3.8 "> 3.8 </ A > ) What debugging features are
680+ < H4 > < A name ="3.7 "> 3.7 </ A > ) What debugging features are
693681 available?</ H4 >
694682
695683< P > PostgreSQL has several features that report status information
@@ -745,7 +733,7 @@ <H4><A name="3.8">3.8</A>) What debugging features are
745733 in the< I > pgsql/data/base/dbname</ I > directory. The client profile
746734 file will be put in the client's current directory.</ P >
747735
748- < H4 > < A name ="3.9 "> 3.9 </ A > ) Why do I get< I > "Sorry, too many
736+ < H4 > < A name ="3.8 "> 3.8 </ A > ) Why do I get< I > "Sorry, too many
749737 clients"</ I > when trying to connect?</ H4 >
750738
751739< P > You need to increase< I > postmaster</ I > 's limit on how many
@@ -775,7 +763,7 @@ <H4><A name="3.9">3.9</A>) Why do I get <I>"Sorry, too many
775763 the MaxBackendId constant in
776764< I > include/storage/sinvaladt.h</ I > .</ P >
777765
778- < H4 > < A name ="3.10 "> 3.10 </ A > ) What are the< I > pg_sorttempNNN.NN</ I >
766+ < H4 > < A name ="3.9 "> 3.9 </ A > ) What are the< I > pg_sorttempNNN.NN</ I >
779767 files in my database directory?</ H4 >
780768
781769< P > They are temporary files generated by the query executor. For
@@ -862,30 +850,32 @@ <H4><A name="4.5">4.5</A>) What is the maximum size for a row, a
862850< H4 > < A name ="4.6 "> 4.6</ A > ) How much database disk space is required
863851 to store data from a typical text file?</ H4 >
864852
865- < P > A PostgreSQL database mayneed six-and-a-half times the disk
866- space required to storethe datain aflat file.</ P >
853+ < P > A PostgreSQL database mayrequire up to five times the disk space
854+ to store datafrom atext file.</ P >
867855
868- < P > Consider a file of 300,000 lines with two integers on each line.
869- The flat file is 2.4 MB. The size of the PostgreSQL database file
870- containing this data can be estimated at 14 MB:</ P >
856+ < P > As an example, consider a file of 100,000 lines with an integer
857+ and text description on each line. Suppose the text string avergages
858+ twenty characters in length. The flat file would be 2.8 MB. The size
859+ of the PostgreSQL database file containing this data can be
860+ estimated as 6.6 MB:</ P >
871861< PRE >
872862 36 bytes: each row header (approximate)
873- + 8 bytes: two int fields @ 4 bytes each
863+ 26 bytes: two int fields @ 4 bytes each
874864 + 4 bytes: pointer on page to tuple
875865 ----------------------------------------
876- 48 bytes per row
866+ 66 bytes per row
877867
878868 The data page size in PostgreSQL is 8192 bytes (8 KB), so:
879869
880870 8192 bytes per page
881- ------------------- =171 rows per database page (roundedup )
882- 48 bytes per row
871+ ------------------- =124 rows per database page (roundeddown )
872+ 66 bytes per row
883873
884- 300000 data rows
885- -------------------- =1755 database pages
886- 171 rows per page
874+ 100000 data rows
875+ -------------------- =807 database pages (rounded up)
876+ 124 rows per page
887877
888- 1755 database pages * 8192 bytes per page =14,376,960 bytes (14 MB)
878+ 807 database pages * 8192 bytes per page =6,610,944 bytes (6.6 MB)
889879</ PRE >
890880
891881< P > Indexes do not require as much overhead, but do contain the data