14
14
alink ="#0000ff ">
15
15
< H1 > Frequently Asked Questions (FAQ) for PostgreSQL</ H1 >
16
16
17
- < P > Last updated: Tue Feb 12 12:18:09 EST 2002</ P >
17
+ < P > Last updated: Thu Feb 14 12:14:47 EST 2002</ P >
18
18
19
19
< P > Current maintainer: Bruce Momjian (< A href =
20
20
"mailto:pgman@candle.pha.pa.us "> pgman@candle.pha.pa.us</ A > )< BR >
@@ -72,16 +72,13 @@ <H2 align="center">Administrative Questions</H2>
72
72
get < I > IpcMemoryCreate</ I > errors. Why?< BR >
73
73
< A href ="#3.4 "> 3.4</ A > ) When I try to start < I > postmaster</ I > , I
74
74
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
80
77
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
83
80
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 >
85
82
files in my database directory?< BR >
86
83
87
84
@@ -633,8 +630,8 @@ <H4><A name="3.4">3.4</A>) When I try to start <I>postmaster</I>, I
633
630
PostgreSQL Administrator's Guide for more detailed information
634
631
about shared memory and semaphores.</ P >
635
632
636
- < H4 > < A name ="3.5 "> 3.5</ A > ) How do I prevent other hosts from
637
- accessing my PostgreSQL database ?</ H4 >
633
+ < H4 > < A name ="3.5 "> 3.5</ A > ) How do I control connections from other
634
+ hosts ?</ H4 >
638
635
639
636
< P > By default, PostgreSQL only allows connections from the local
640
637
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
643
640
< I > $PGDATA/pg_hba.conf</ I > accordingly. This will allow TCP/IP
644
641
connections.</ P >
645
642
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
656
644
better performance?</ H4 >
657
645
658
646
< 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
689
677
data in tables to match an index. See the < SMALL > CLUSTER</ SMALL >
690
678
manual page for more details.</ P >
691
679
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
693
681
available?</ H4 >
694
682
695
683
< 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
745
733
in the < I > pgsql/data/base/dbname</ I > directory. The client profile
746
734
file will be put in the client's current directory.</ P >
747
735
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
749
737
clients"</ I > when trying to connect?</ H4 >
750
738
751
739
< 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
775
763
the MaxBackendId constant in
776
764
< I > include/storage/sinvaladt.h</ I > .</ P >
777
765
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 >
779
767
files in my database directory?</ H4 >
780
768
781
769
< 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
862
850
< H4 > < A name ="4.6 "> 4.6</ A > ) How much database disk space is required
863
851
to store data from a typical text file?</ H4 >
864
852
865
- < P > A PostgreSQL database may need six-and-a-half times the disk
866
- space required to store the data in a flat file.</ P >
853
+ < P > A PostgreSQL database may require up to five times the disk space
854
+ to store data from a text file.</ P >
867
855
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 >
871
861
< PRE >
872
862
36 bytes: each row header (approximate)
873
- + 8 bytes: two int fields @ 4 bytes each
863
+ 26 bytes: two int fields @ 4 bytes each
874
864
+ 4 bytes: pointer on page to tuple
875
865
----------------------------------------
876
- 48 bytes per row
866
+ 66 bytes per row
877
867
878
868
The data page size in PostgreSQL is 8192 bytes (8 KB), so:
879
869
880
870
8192 bytes per page
881
- ------------------- = 171 rows per database page (rounded up )
882
- 48 bytes per row
871
+ ------------------- = 124 rows per database page (rounded down )
872
+ 66 bytes per row
883
873
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
887
877
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)
889
879
</ PRE >
890
880
891
881
< P > Indexes do not require as much overhead, but do contain the data
0 commit comments