mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-04 00:02:52 -05:00 
			
		
		
		
	Update FAQ.
This commit is contained in:
		
							parent
							
								
									3576820e78
								
							
						
					
					
						commit
						ceec779ab5
					
				
							
								
								
									
										59
									
								
								doc/FAQ
									
									
									
									
									
								
							
							
						
						
									
										59
									
								
								doc/FAQ
									
									
									
									
									
								
							@ -1,7 +1,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                Frequently Asked Questions (FAQ) for PostgreSQL
 | 
					                Frequently Asked Questions (FAQ) for PostgreSQL
 | 
				
			||||||
                                       
 | 
					                                       
 | 
				
			||||||
   Last updated: Tue Feb 12 12:18:09 EST 2002
 | 
					   Last updated: Thu Feb 14 12:14:47 EST 2002
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
   Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
 | 
					   Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
@ -48,13 +48,11 @@
 | 
				
			|||||||
   Why?
 | 
					   Why?
 | 
				
			||||||
   3.4) When I try to start postmaster, I get IpcSemaphoreCreate errors.
 | 
					   3.4) When I try to start postmaster, I get IpcSemaphoreCreate errors.
 | 
				
			||||||
   Why?
 | 
					   Why?
 | 
				
			||||||
   3.5) How do I prevent other hosts from accessing my PostgreSQL
 | 
					   3.5) How do I control connections from other hosts?
 | 
				
			||||||
   database?
 | 
					   3.6) How do I tune the database engine for better performance?
 | 
				
			||||||
   3.6) Why can't I connect to my database from another machine?
 | 
					   3.7) What debugging features are available?
 | 
				
			||||||
   3.7) How do I tune the database engine for better performance?
 | 
					   3.8) Why do I get "Sorry, too many clients" when trying to connect?
 | 
				
			||||||
   3.8) What debugging features are available?
 | 
					   3.9) What are the pg_sorttempNNN.NN files in my database directory?
 | 
				
			||||||
   3.9) Why do I get "Sorry, too many clients" when trying to connect?
 | 
					 | 
				
			||||||
   3.10) What are the pg_sorttempNNN.NN files in my database directory?
 | 
					 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
                           Operational Questions
 | 
					                           Operational Questions
 | 
				
			||||||
                                      
 | 
					                                      
 | 
				
			||||||
@ -484,7 +482,7 @@
 | 
				
			|||||||
   Administrator's Guide for more detailed information about shared
 | 
					   Administrator's Guide for more detailed information about shared
 | 
				
			||||||
   memory and semaphores.
 | 
					   memory and semaphores.
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
    3.5) How do I prevent other hosts from accessing my PostgreSQL database?
 | 
					    3.5) How do I control connections from other hosts?
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
   By default, PostgreSQL only allows connections from the local machine
 | 
					   By default, PostgreSQL only allows connections from the local machine
 | 
				
			||||||
   using Unix domain sockets. Other machines will not be able to connect
 | 
					   using Unix domain sockets. Other machines will not be able to connect
 | 
				
			||||||
@ -492,14 +490,7 @@
 | 
				
			|||||||
   authentication by modifying the file $PGDATA/pg_hba.conf accordingly.
 | 
					   authentication by modifying the file $PGDATA/pg_hba.conf accordingly.
 | 
				
			||||||
   This will allow TCP/IP connections.
 | 
					   This will allow TCP/IP connections.
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
    3.6) Why can't I connect to my database from another machine?
 | 
					    3.6) How do I tune the database engine for better performance?
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
   The default configuration allows only Unix domain socket connections
 | 
					 | 
				
			||||||
   from the local machine. To enable TCP/IP connections, make sure
 | 
					 | 
				
			||||||
   postmaster has been started with the -i option, and add an appropriate
 | 
					 | 
				
			||||||
   host entry to the file pgsql/data/pg_hba.conf.
 | 
					 | 
				
			||||||
   
 | 
					 | 
				
			||||||
    3.7) How do I tune the database engine for better performance?
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
   Certainly, indexes can speed up queries. The EXPLAIN command allows
 | 
					   Certainly, indexes can speed up queries. The EXPLAIN command allows
 | 
				
			||||||
   you to see how PostgreSQL is interpreting your query, and which
 | 
					   you to see how PostgreSQL is interpreting your query, and which
 | 
				
			||||||
@ -530,7 +521,7 @@
 | 
				
			|||||||
   You can also use the CLUSTER command to group data in tables to match
 | 
					   You can also use the CLUSTER command to group data in tables to match
 | 
				
			||||||
   an index. See the CLUSTER manual page for more details.
 | 
					   an index. See the CLUSTER manual page for more details.
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
    3.8) What debugging features are available?
 | 
					    3.7) What debugging features are available?
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
   PostgreSQL has several features that report status information that
 | 
					   PostgreSQL has several features that report status information that
 | 
				
			||||||
   can be valuable for debugging purposes.
 | 
					   can be valuable for debugging purposes.
 | 
				
			||||||
@ -577,7 +568,7 @@
 | 
				
			|||||||
   pgsql/data/base/dbname directory. The client profile file will be put
 | 
					   pgsql/data/base/dbname directory. The client profile file will be put
 | 
				
			||||||
   in the client's current directory.
 | 
					   in the client's current directory.
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
    3.9) Why do I get "Sorry, too many clients" when trying to connect?
 | 
					    3.8) Why do I get "Sorry, too many clients" when trying to connect?
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
   You need to increase postmaster's limit on how many concurrent backend
 | 
					   You need to increase postmaster's limit on how many concurrent backend
 | 
				
			||||||
   processes it can start.
 | 
					   processes it can start.
 | 
				
			||||||
@ -601,7 +592,7 @@
 | 
				
			|||||||
   was 64, and changing it required a rebuild after altering the
 | 
					   was 64, and changing it required a rebuild after altering the
 | 
				
			||||||
   MaxBackendId constant in include/storage/sinvaladt.h.
 | 
					   MaxBackendId constant in include/storage/sinvaladt.h.
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
    3.10) What are the pg_sorttempNNN.NN files in my database directory?
 | 
					    3.9) What are the pg_sorttempNNN.NN files in my database directory?
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
   They are temporary files generated by the query executor. For example,
 | 
					   They are temporary files generated by the query executor. For example,
 | 
				
			||||||
   if a sort needs to be done to satisfy an ORDER BY, and the sort
 | 
					   if a sort needs to be done to satisfy an ORDER BY, and the sort
 | 
				
			||||||
@ -671,29 +662,31 @@
 | 
				
			|||||||
    4.6) How much database disk space is required to store data from a typical
 | 
					    4.6) How much database disk space is required to store data from a typical
 | 
				
			||||||
    text file?
 | 
					    text file?
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
   A PostgreSQL database may need six-and-a-half times the disk space
 | 
					   A PostgreSQL database may require up to five times the disk space to
 | 
				
			||||||
   required to store the data in a flat file.
 | 
					   store data from a text file.
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
   Consider a file of 300,000 lines with two integers on each line. The
 | 
					   As an example, consider a file of 100,000 lines with an integer and
 | 
				
			||||||
   flat file is 2.4 MB. The size of the PostgreSQL database file
 | 
					   text description on each line. Suppose the text string avergages
 | 
				
			||||||
   containing this data can be estimated at 14 MB:
 | 
					   twenty characters in length. The flat file would be 2.8 MB. The size
 | 
				
			||||||
 | 
					   of the PostgreSQL database file containing this data can be estimated
 | 
				
			||||||
 | 
					   as 6.6 MB:
 | 
				
			||||||
    36 bytes: each row header (approximate)
 | 
					    36 bytes: each row header (approximate)
 | 
				
			||||||
   + 8 bytes: two int fields @ 4 bytes each
 | 
					    26 bytes: two int fields @ 4 bytes each
 | 
				
			||||||
   + 4 bytes: pointer on page to tuple
 | 
					   + 4 bytes: pointer on page to tuple
 | 
				
			||||||
   ----------------------------------------
 | 
					   ----------------------------------------
 | 
				
			||||||
    48 bytes per row
 | 
					    66 bytes per row
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   The data page size in PostgreSQL is 8192 bytes (8 KB), so:
 | 
					   The data page size in PostgreSQL is 8192 bytes (8 KB), so:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   8192 bytes per page
 | 
					   8192 bytes per page
 | 
				
			||||||
   -------------------   =  171 rows per database page (rounded up)
 | 
					   -------------------   =  124 rows per database page (rounded down)
 | 
				
			||||||
     48 bytes per row
 | 
					     66 bytes per row
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   300000 data rows
 | 
					   100000 data rows
 | 
				
			||||||
   --------------------  =  1755 database pages
 | 
					   --------------------  =  807 database pages (rounded up)
 | 
				
			||||||
      171 rows per page
 | 
					      124 rows per page
 | 
				
			||||||
 | 
					
 | 
				
			||||||
1755 database pages * 8192 bytes per page  =  14,376,960 bytes (14 MB)
 | 
					807 database pages * 8192 bytes per page  =  6,610,944 bytes (6.6 MB)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Indexes do not require as much overhead, but do contain the data that
 | 
					   Indexes do not require as much overhead, but do contain the data that
 | 
				
			||||||
   is being indexed, so they can be large also.
 | 
					   is being indexed, so they can be large also.
 | 
				
			||||||
 | 
				
			|||||||
@ -14,7 +14,7 @@
 | 
				
			|||||||
  alink="#0000ff">
 | 
					  alink="#0000ff">
 | 
				
			||||||
    <H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
 | 
					    <H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <P>Last updated: Tue Feb 12 12:18:09 EST 2002</P>
 | 
					    <P>Last updated: Thu Feb 14 12:14:47 EST 2002</P>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <P>Current maintainer: Bruce Momjian (<A href=
 | 
					    <P>Current maintainer: 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>
 | 
				
			||||||
@ -72,16 +72,13 @@
 | 
				
			|||||||
    get <I>IpcMemoryCreate</I> errors. Why?<BR>
 | 
					    get <I>IpcMemoryCreate</I> errors. Why?<BR>
 | 
				
			||||||
     <A href="#3.4">3.4</A>) When I try to start <I>postmaster</I>, I
 | 
					     <A href="#3.4">3.4</A>) When I try to start <I>postmaster</I>, I
 | 
				
			||||||
    get <I>IpcSemaphoreCreate</I> errors. Why?<BR>
 | 
					    get <I>IpcSemaphoreCreate</I> errors. Why?<BR>
 | 
				
			||||||
     <A href="#3.5">3.5</A>) How do I prevent other hosts from
 | 
					     <A href="#3.5">3.5</A>) How do I control connections from other hosts?<BR>
 | 
				
			||||||
    accessing my PostgreSQL database?<BR>
 | 
					     <A href="#3.6">3.6</A>) How do I tune the database engine for
 | 
				
			||||||
     <A href="#3.6">3.6</A>) Why can't I connect to my database from
 | 
					 | 
				
			||||||
    another machine?<BR>
 | 
					 | 
				
			||||||
     <A href="#3.7">3.7</A>) How do I tune the database engine for
 | 
					 | 
				
			||||||
    better performance?<BR>
 | 
					    better performance?<BR>
 | 
				
			||||||
     <A href="#3.8">3.8</A>) What debugging features are available?<BR>
 | 
					     <A href="#3.7">3.7</A>) What debugging features are available?<BR>
 | 
				
			||||||
     <A href="#3.9">3.9</A>) Why do I get <I>"Sorry, too many
 | 
					     <A href="#3.8">3.8</A>) Why do I get <I>"Sorry, too many
 | 
				
			||||||
    clients"</I> when trying to connect?<BR>
 | 
					    clients"</I> when trying to connect?<BR>
 | 
				
			||||||
     <A href="#3.10">3.10</A>) What are the <I>pg_sorttempNNN.NN</I>
 | 
					     <A href="#3.9">3.9</A>) What are the <I>pg_sorttempNNN.NN</I>
 | 
				
			||||||
    files in my database directory?<BR>
 | 
					    files in my database directory?<BR>
 | 
				
			||||||
     
 | 
					     
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -633,8 +630,8 @@
 | 
				
			|||||||
    PostgreSQL Administrator's Guide for more detailed information
 | 
					    PostgreSQL Administrator's Guide for more detailed information
 | 
				
			||||||
    about shared memory and semaphores.</P>
 | 
					    about shared memory and semaphores.</P>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <H4><A name="3.5">3.5</A>) How do I prevent other hosts from
 | 
					    <H4><A name="3.5">3.5</A>) How do I control connections from other
 | 
				
			||||||
    accessing my PostgreSQL database?</H4>
 | 
					    hosts?</H4>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <P>By default, PostgreSQL only allows connections from the local
 | 
					    <P>By default, PostgreSQL only allows connections from the local
 | 
				
			||||||
    machine using Unix domain sockets. Other machines will not be able
 | 
					    machine using Unix domain sockets. Other machines will not be able
 | 
				
			||||||
@ -643,16 +640,7 @@
 | 
				
			|||||||
    <I>$PGDATA/pg_hba.conf</I> accordingly. This will allow TCP/IP
 | 
					    <I>$PGDATA/pg_hba.conf</I> accordingly. This will allow TCP/IP
 | 
				
			||||||
    connections.</P>
 | 
					    connections.</P>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <H4><A name="3.6">3.6</A>) Why can't I connect to my database from
 | 
					    <H4><A name="3.6">3.6</A>) How do I tune the database engine for
 | 
				
			||||||
    another machine?</H4>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <P>The default configuration allows only Unix domain socket
 | 
					 | 
				
			||||||
    connections from the local machine. To enable TCP/IP connections,
 | 
					 | 
				
			||||||
    make sure <I>postmaster</I> has been started with the <I>-i</I>
 | 
					 | 
				
			||||||
    option, and add an appropriate host entry to the file
 | 
					 | 
				
			||||||
    <I>pgsql/data/pg_hba.conf</I>.</P>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <H4><A name="3.7">3.7</A>) How do I tune the database engine for
 | 
					 | 
				
			||||||
    better performance?</H4>
 | 
					    better performance?</H4>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <P>Certainly, indexes can speed up queries. The
 | 
					    <P>Certainly, indexes can speed up queries. The
 | 
				
			||||||
@ -689,7 +677,7 @@
 | 
				
			|||||||
    data in tables to match an index. See the <SMALL>CLUSTER</SMALL>
 | 
					    data in tables to match an index. See the <SMALL>CLUSTER</SMALL>
 | 
				
			||||||
    manual page for more details.</P>
 | 
					    manual page for more details.</P>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <H4><A name="3.8">3.8</A>) What debugging features are
 | 
					    <H4><A name="3.7">3.7</A>) What debugging features are
 | 
				
			||||||
    available?</H4>
 | 
					    available?</H4>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <P>PostgreSQL has several features that report status information
 | 
					    <P>PostgreSQL has several features that report status information
 | 
				
			||||||
@ -745,7 +733,7 @@
 | 
				
			|||||||
    in the <I>pgsql/data/base/dbname</I> directory. The client profile
 | 
					    in the <I>pgsql/data/base/dbname</I> directory. The client profile
 | 
				
			||||||
    file will be put in the client's current directory.</P>
 | 
					    file will be put in the client's current directory.</P>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <H4><A name="3.9">3.9</A>) Why do I get <I>"Sorry, too many
 | 
					    <H4><A name="3.8">3.8</A>) Why do I get <I>"Sorry, too many
 | 
				
			||||||
    clients"</I> when trying to connect?</H4>
 | 
					    clients"</I> when trying to connect?</H4>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <P>You need to increase <I>postmaster</I>'s limit on how many
 | 
					    <P>You need to increase <I>postmaster</I>'s limit on how many
 | 
				
			||||||
@ -775,7 +763,7 @@
 | 
				
			|||||||
    the MaxBackendId constant in
 | 
					    the MaxBackendId constant in
 | 
				
			||||||
    <I>include/storage/sinvaladt.h</I>.</P>
 | 
					    <I>include/storage/sinvaladt.h</I>.</P>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <H4><A name="3.10">3.10</A>) What are the <I>pg_sorttempNNN.NN</I>
 | 
					    <H4><A name="3.9">3.9</A>) What are the <I>pg_sorttempNNN.NN</I>
 | 
				
			||||||
    files in my database directory?</H4>
 | 
					    files in my database directory?</H4>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <P>They are temporary files generated by the query executor. For
 | 
					    <P>They are temporary files generated by the query executor. For
 | 
				
			||||||
@ -862,30 +850,32 @@
 | 
				
			|||||||
    <H4><A name="4.6">4.6</A>) How much database disk space is required
 | 
					    <H4><A name="4.6">4.6</A>) How much database disk space is required
 | 
				
			||||||
    to store data from a typical text file?</H4>
 | 
					    to store data from a typical text file?</H4>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <P>A PostgreSQL database may need six-and-a-half times the disk
 | 
					    <P>A PostgreSQL database may require up to five times the disk space
 | 
				
			||||||
    space required to store the data in a flat file.</P>
 | 
					    to store data from a text file.</P>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <P>Consider a file of 300,000 lines with two integers on each line.
 | 
					    <P>As an example, consider a file of 100,000 lines with an integer
 | 
				
			||||||
    The flat file is 2.4 MB. The size of the PostgreSQL database file
 | 
					    and text description on each line. Suppose the text string avergages
 | 
				
			||||||
    containing this data can be estimated at 14 MB:</P>
 | 
					    twenty characters in length. The flat file would be 2.8 MB. The size
 | 
				
			||||||
 | 
					    of the PostgreSQL database file containing this data can be
 | 
				
			||||||
 | 
					    estimated as 6.6 MB:</P>
 | 
				
			||||||
<PRE>
 | 
					<PRE>
 | 
				
			||||||
    36 bytes: each row header (approximate)
 | 
					    36 bytes: each row header (approximate)
 | 
				
			||||||
   + 8 bytes: two int fields @ 4 bytes each
 | 
					    26 bytes: two int fields @ 4 bytes each
 | 
				
			||||||
   + 4 bytes: pointer on page to tuple
 | 
					   + 4 bytes: pointer on page to tuple
 | 
				
			||||||
   ----------------------------------------
 | 
					   ----------------------------------------
 | 
				
			||||||
    48 bytes per row
 | 
					    66 bytes per row
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   The data page size in PostgreSQL is 8192 bytes (8 KB), so:
 | 
					   The data page size in PostgreSQL is 8192 bytes (8 KB), so:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   8192 bytes per page
 | 
					   8192 bytes per page
 | 
				
			||||||
   -------------------   =  171 rows per database page (rounded up)
 | 
					   -------------------   =  124 rows per database page (rounded down)
 | 
				
			||||||
     48 bytes per row
 | 
					     66 bytes per row
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   300000 data rows
 | 
					   100000 data rows
 | 
				
			||||||
   --------------------  =  1755 database pages
 | 
					   --------------------  =  807 database pages (rounded up)
 | 
				
			||||||
      171 rows per page
 | 
					      124 rows per page
 | 
				
			||||||
 | 
					
 | 
				
			||||||
1755 database pages * 8192 bytes per page  =  14,376,960 bytes (14 MB)
 | 
					807 database pages * 8192 bytes per page  =  6,610,944 bytes (6.6 MB)
 | 
				
			||||||
</PRE>
 | 
					</PRE>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <P>Indexes do not require as much overhead, but do contain the data
 | 
					    <P>Indexes do not require as much overhead, but do contain the data
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user