mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-30 00:04:49 -04:00 
			
		
		
		
	UPdate FAQ.
This commit is contained in:
		
							parent
							
								
									35378a4efc
								
							
						
					
					
						commit
						6c42b360cc
					
				
							
								
								
									
										500
									
								
								doc/FAQ
									
									
									
									
									
								
							
							
						
						
									
										500
									
								
								doc/FAQ
									
									
									
									
									
								
							| @ -1,7 +1,7 @@ | ||||
| 
 | ||||
|                 Frequently Asked Questions (FAQ) for PostgreSQL | ||||
|                                         | ||||
|    Last updated: Tue Jul 29 10:09:15 EDT 1997 | ||||
|    Last updated: Thu Sep 4 01:32:22 EDT 1997 | ||||
|    Version: 6.1.1 | ||||
|     | ||||
|    Current maintainer: Bruce Momjian (maillist@candle.pha.pa.us) | ||||
| @ -16,9 +16,6 @@ | ||||
|    http://postgreSQL.org/docs/FAQ-irix.shtml. | ||||
|     | ||||
|    Changes in this version (* = modified, + = new): | ||||
|      * 3.42) What is Genetic Query Optimization? | ||||
|      * 3.43) I am running Solaris and my dates display wrong. Why? | ||||
|         | ||||
|      _________________________________________________________________ | ||||
|     | ||||
| Questions answered: | ||||
| @ -32,12 +29,16 @@ Questions answered: | ||||
|    1.5) Support for PostgreSQL | ||||
|    1.6) Latest release of PostgreSQL | ||||
|    1.7) Is there a commercial version of PostgreSQL? | ||||
|    1.9) What version of SQL does PostgreSQL use? | ||||
|    1.8) What version of SQL does PostgreSQL use? | ||||
|    1.9) What documentation is available for PostgreSQL? | ||||
|    1.10) Does PostgreSQL work with databases from earlier versions of | ||||
|    postgres? | ||||
|    1.11) How many people use PostgreSQL? | ||||
|    1.11) Are there ODBC drivers for PostgreSQL? | ||||
|    1.12) What tools are available for hooking postgres to Web pages? | ||||
|    1.13) Does PostgreSQL have a graphical user interface? A report | ||||
|    generator? A embedded query language interface? | ||||
|     | ||||
|   2) Installation questions | ||||
|   2) Installation/Configuration questions | ||||
|    | ||||
|    2.1) initdb doesn't run | ||||
|    2.2) when I start up the postmaster, I get "FindBackend: could not | ||||
| @ -52,60 +53,43 @@ Questions answered: | ||||
|    2.6) When I try to start the postmaster, I get IpcMemoryCreate errors. | ||||
|    2.7) I have changed a source file, but a recompile does not see the | ||||
|    change? | ||||
|    2.8) How do I prevent other hosts from accessing my PostgreSQL | ||||
|    2.9) I can't access the database as the 'root' user. | ||||
|    2.10) All my servers crash under concurrent table access. Why? | ||||
|    2.11) How do I tune the database engine for better performance? | ||||
|    2.12) What debugging features are available in PostgreSQL? | ||||
|    2.13) How do I enable more than 32 concurrent backends? | ||||
|     | ||||
|   3) Operational questions | ||||
|    | ||||
|    3.1) How do I specify a KEY or other constraints on a column? | ||||
|    3.2) Does PostgreSQL support nested subqueries? | ||||
|    3.3) How do I define a unique indices? | ||||
|    3.4) I've having a lot of problems using rules. | ||||
|    3.5) I can't seem to write into the middle of large objects reliably. | ||||
|    3.6) Does PostgreSQL have a graphical user interface? A report | ||||
|    generator? A embedded query language interface? | ||||
|    3.7) How can I write client applications to PostgreSQL? | ||||
|    3.8) How do I prevent other hosts from accessing my PostgreSQL | ||||
|    3.9) How do I set up a pg_group? | ||||
|    3.10) What is the exact difference between binary cursors and normal | ||||
|    3.1) Does PostgreSQL support nested subqueries? | ||||
|    3.2) I've having a lot of problems using rules. | ||||
|    3.3) I can't seem to write into the middle of large objects reliably. | ||||
|    3.4) How can I write client applications to PostgreSQL? | ||||
|    3.5) How do I set up a pg_group? | ||||
|    3.6) What is the exact difference between binary cursors and normal | ||||
|    cursors? | ||||
|    3.11) Why doesn't the != operator work? | ||||
|    3.12) What is a R-tree index and what is it used for? | ||||
|    3.13) What is the maximum size for a tuple? | ||||
|    3.14) I defined indices but my queries don't seem to make use of them. | ||||
|    3.7) What is a R-tree index and what is it used for? | ||||
|    3.8) What is the maximum size for a tuple? | ||||
|    3.9) I defined indices but my queries don't seem to make use of them. | ||||
|    Why? | ||||
|    3.15) Are there ODBC drivers for PostgreSQL? | ||||
|    3.16) How do I use postgres for multi-dimensional indexing (> 2 | ||||
|    dimensions)? | ||||
|    3.17) How do I do regular expression searches? case-insensitive regexp | ||||
|    3.10) How do I do regular expression searches? case-insensitive regexp | ||||
|    searching? | ||||
|    3.18) I can't access the database as the 'root' user. | ||||
|    3.19) I experienced a server crash during a vacuum. How do I remove | ||||
|    3.11) I experienced a server crash during a vacuum. How do I remove | ||||
|    the lock file? | ||||
|    3.20) What is the difference between the various character types? | ||||
|    3.21) In a query, how do I detect if a field is NULL? | ||||
|    3.22) How do I see how the query optimizer is evaluating my query? | ||||
|    3.23) How do I create a serial field? | ||||
|    3.24) How do I create a multi-column index? | ||||
|    3.25) What are the temp_XXX files in my database directory? | ||||
|    3.26) Why are my table files not getting any smaller after a delete? | ||||
|    3.27) Why can't I connect to my database from another machine? | ||||
|    3.28) I get the error 'default index class unsupported' when creating | ||||
|    an index. How do I do it? | ||||
|    3.29) Why does creating an index crash the backend server? | ||||
|    3.30) How do I find out what indexes or operations are defined in the | ||||
|    3.12) What is the difference between the various character types? | ||||
|    3.13) In a query, how do I detect if a field is NULL? | ||||
|    3.14) How do I see how the query optimizer is evaluating my query? | ||||
|    3.15) How do I create a serial field? | ||||
|    3.16) What are the pg_psort.XXX files in my database directory? | ||||
|    3.17) Why can't I connect to my database from another machine? | ||||
|    3.18) How do I find out what indexes or operations are defined in the | ||||
|    database? | ||||
|    3.31) Why do statements require an extra character at the end? Why | ||||
|    does 'createuser' return 'unexpected last match in input()'? Why does | ||||
|    pg_dump fail? | ||||
|    3.32) All my servers crash under concurrent table access. Why? | ||||
|    3.33) What tools are available for hooking postgres to Web pages? | ||||
|    3.34) What is the time-warp feature and how does it relate to vacuum? | ||||
|    3.35) How do I tune the database engine for better performance? | ||||
|    3.36) What debugging features are available in PostgreSQL? | ||||
|    3.37) What is an oid? What is a tid? | ||||
|    3.38) What is the meaning of some of the terms used in Postgres? | ||||
|    3.39) What is Genetic Query Optimization? | ||||
|    3.40) I am running Solaris and my dates display wrong. Why? 3.41) How | ||||
|    do I enable more than 32 concurrent backends? | ||||
|    3.19) What is the time-warp feature and how does it relate to vacuum? | ||||
|    3.20) What is an oid? What is a tid? | ||||
|    3.21) What is the meaning of some of the terms used in Postgres? | ||||
|    3.22) What is Genetic Query Optimization? | ||||
|    3.23) How do you remove a column from a table? | ||||
|     | ||||
|   4) Questions about extending PostgreSQL | ||||
|    | ||||
| @ -260,10 +244,7 @@ Section 1: General Questions | ||||
|    on July 22, 1997. For information about what is new in 6.1.1, see our | ||||
|    TODO list on our WWW page. | ||||
|     | ||||
|    We expect a 7.0 release in several months that will remove time-travel | ||||
|    and reduce by 50% the size of on-disk system columns maintained for | ||||
|    each row in a table. This release will also require a dump and | ||||
|    restore. | ||||
|    We expect a 6.2 release at the end of September. | ||||
|     | ||||
|   1.7) Is there a commercial version of PostgreSQL? | ||||
|    | ||||
| @ -298,10 +279,6 @@ Section 1: General Questions | ||||
|   1.10) Does PostgreSQL work with databases from earlier versions of postgres? | ||||
|    | ||||
|    PostgreSQL v1.09 is compatible with databases created with v1.01. | ||||
|    Those upgrading from 1.0 should read the directions in the | ||||
|    MIGRATION_1.0_TO_1.02 directory. | ||||
|     | ||||
|    Upgrading to 6.0 requires a dump and restore from previous releases. | ||||
|     | ||||
|    Upgrading to 6.1 requires a dump and restore from previous releases. | ||||
|     | ||||
| @ -314,13 +291,49 @@ Section 1: General Questions | ||||
|    first without a dump/reload, then dump the data from 1.09, and then | ||||
|    load it into 6.1.1. | ||||
|     | ||||
|   1.11) How many people use PostgreSQL? | ||||
|   1.11) Are there ODBC drivers for PostgreSQL? | ||||
|    | ||||
|    Since we don't have any licensing or registration scheme, it's | ||||
|    impossible to tell. We do know hundreds copies of PostgreSQL v1.* have | ||||
|    been downloaded, and that there many hundreds of subscribers to the | ||||
|    mailing lists. | ||||
|    There are two ODBC drivers available, PostODBC and OpenLink ODBC. | ||||
|     | ||||
|    For all people being interested in PostODBC, there are now two mailing | ||||
|    lists devoted to the discussion of PostODBC. The mailing lists are: | ||||
|      * postodbc-users@listserv.direct. net | ||||
|      * postodbc-developers@listse rv.direct.net | ||||
|         | ||||
|    these lists are ordinary majordomo mailing lists. You can subscribe by | ||||
|    sending a mail to: | ||||
|      * majordomo@listserv.direct.net | ||||
|         | ||||
|    OpenLink ODBC is very popular. You can get it from | ||||
|    http://www.openlinksw.com/postgres.html. It works with our standard | ||||
|    ODBC client software so you'll have Postgres ODBC available on every | ||||
|    client platform we support (Win, Mac, Unix, VMS). | ||||
|     | ||||
|    We will probably be selling this product to people who need | ||||
|    commercial-quality support, but a freeware version will always be | ||||
|    available. Questions to postgres95@openlink.co.uk. | ||||
|     | ||||
|   1.12) What tools are available for hooking postgres to Web pages? | ||||
|    | ||||
|    For web integration, PHP/FI is an excellent interface. The URL for | ||||
|    that is http://www.vex.net/php/ | ||||
|     | ||||
|    PHP is great for simple stuff, but for more complex stuff, some still | ||||
|    use the perl interface and CGI.pm. | ||||
|     | ||||
|    An example of using WWW with C to talk to Postgres is can be tried at: | ||||
|      * http://postgreSQL.org/~mlc | ||||
|         | ||||
|    An WWW gatway based on WDB using perl can be downloaded from: | ||||
|      * http://www.eol.ists.ca/~dunlop/wdb -p95 | ||||
|         | ||||
|   1.13) Does PostgreSQL have a graphical user interface? A report generator? A | ||||
|   embedded query language interface? | ||||
|    | ||||
|    No. No. No. Not in the official distribution at least. Some users have | ||||
|    reported some success at using 'pgbrowse' and 'onyx' as frontends to | ||||
|    PostgreSQL. Several contributions are working on tk based frontend | ||||
|    tools. Ask on the mailing list. | ||||
|      _________________________________________________________________ | ||||
|     | ||||
| Section 2: Installation Questions | ||||
| @ -370,62 +383,115 @@ Section 2: Installation Questions | ||||
|    The Makefiles do not have the proper dependencies for include files. | ||||
|    You have to do a 'make clean' and then another 'make'. | ||||
|     | ||||
|   2.8) How do I prevent other hosts from accessing my PostgreSQL backend? | ||||
|    | ||||
|    Use host-based authentication by modifying the file $PGDATA/pg_hba | ||||
|    accordingly. | ||||
|     | ||||
|   2.9) I can't access the database as the 'root' user. | ||||
|    | ||||
|    You should not create database users with user id 0(root). They will | ||||
|    be unable to access the database. This is a security precaution | ||||
|    because of the ability of any user to dynamically link object modules | ||||
|    into the database engine. | ||||
|     | ||||
|   2.10) All my servers crash under concurrent table access. Why? | ||||
|    | ||||
|    This problem can be caused by a kernel that is not configured to | ||||
|    support semaphores. | ||||
|     | ||||
|   2.11) How do I tune the database engine for better performance? | ||||
|    | ||||
|    There are two things that can be done. You can use Openlink's option | ||||
|    to disable fsync() by starting the postmaster with a '-o -F' option. | ||||
|    This will prevent fsync()'s from flushing to disk after every | ||||
|    transaction. | ||||
|     | ||||
|    You can also use the postmaster -B option to increase the number of | ||||
|    shared memory buffers shared among the backend processes. If you make | ||||
|    this parameter too high, the process will not start or crash | ||||
|    unexpectedly. Each buffer is 8K and the defualt is 64 buffers. | ||||
|     | ||||
|   2.12) What debugging features are available in PostgreSQL? | ||||
|    | ||||
|    PostgreSQL has several features that report status information that | ||||
|    can be valuable for debugging purposes. | ||||
|     | ||||
|    First, by running configure with the -enable-cassert option, many | ||||
|    assert()'s monitor the progress of the backend and halt the program | ||||
|    when something unexpected occurs. | ||||
|     | ||||
|    Both postmaster and postgres have several debug options available. | ||||
|    First, whenever you start the postmaster, make sure you send the | ||||
|    standard output and error to a log file, like: | ||||
| 
 | ||||
| 
 | ||||
|         cd /usr/local/pgsql | ||||
|         ./bin/postmaster >server.log 2>&1 & | ||||
| 
 | ||||
|    This will put a server.log file in the top-level PostgreSQL directory. | ||||
|    This file can contain useful information about problems or errors | ||||
|    encountered by the server. Postmaster has a -d option that allows even | ||||
|    more detailed information to be reported. The -d option takes a number | ||||
|    1-3 that specifies the debug level. The query plans in a verbose debug | ||||
|    file can be formatted using the 'indent' program. Be warned that a | ||||
|    debug level of three generates large log files. | ||||
|     | ||||
|    You can actuall run the postgres backend from the command line, and | ||||
|    type your SQL statement directly. This is recommended ONLY for | ||||
|    debugging purposes. Note that a newline terminates the query, not a | ||||
|    semicolon. If you have compiled with debugging symbols, you can | ||||
|    perhaps use a debugger to see what is happening. Because the backend | ||||
|    was not started from the postmaster, it is not running in an identical | ||||
|    environment and locking/backend interaction problems may not be | ||||
|    duplicated. Some operating system can attach to a running backend | ||||
|    directly to diagnose problems. | ||||
|     | ||||
|    The postgres program has a -s, -A, -t options that can be very usefull | ||||
|    for debugging and performance measurements. | ||||
|     | ||||
|    The EXPLAIN command (see this FAQ) allows you to see how PostgreSQL is | ||||
|    iterpreting your query. | ||||
|     | ||||
|    You can also compile with profiling to see what functions are taking | ||||
|    execution time. | ||||
|     | ||||
|   2.13) How do I enable more than 32 concurrent backends? | ||||
|    | ||||
|    Edit include/storage/sinvaladt.h, and change the value of | ||||
|    MaxBackendId. In the future, we plan to make this a configurable | ||||
|    prameter. | ||||
|      _________________________________________________________________ | ||||
|     | ||||
| Section 3: PostgreSQL Features | ||||
| 
 | ||||
|   3.1) How do I specify a KEY or other constraints on a column? | ||||
|    | ||||
|    Column constraints are not supported in PostgreSQL. As a consequence, | ||||
|    the system does not check for duplicates. | ||||
|     | ||||
|    Under 6.0, create a unique index on the column. Attempts to create | ||||
|    duplicate of that column will report an error. | ||||
|     | ||||
|   3.2) Does PostgreSQL support nested subqueries? | ||||
|   3.1) Does PostgreSQL support nested subqueries? | ||||
|    | ||||
|    Subqueries are not implemented, but they can be simulated using sql | ||||
|    functions. | ||||
|     | ||||
|   3.3) How do I define a unique indices? | ||||
|    | ||||
|    PostgreSQL 6.0 supports unique indices. | ||||
|     | ||||
|   3.4) I've having a lot of problems using rules. | ||||
|   3.2) I've having a lot of problems using rules. | ||||
|    | ||||
|    Currently, the rule system in PostgreSQL is mostly broken. It works | ||||
|    enough to support the view mechanism, but that's about it. Use | ||||
|    PostgreSQL rules at your own peril. | ||||
|     | ||||
|   3.5) I can't seem to write into the middle of large objects reliably. | ||||
|   3.3) I can't seem to write into the middle of large objects reliably. | ||||
|    | ||||
|    The Inversion large object system in PostgreSQL is also mostly broken. | ||||
|    It works well enough for storing large wads of data and reading them | ||||
|    back out, but the implementation has some underlying problems. Use | ||||
|    PostgreSQL large objects at your own peril. | ||||
|     | ||||
|   3.6) Does PostgreSQL have a graphical user interface? A report generator? A | ||||
|   embedded query language interface? | ||||
|    | ||||
|    No. No. No. Not in the official distribution at least. Some users have | ||||
|    reported some success at using 'pgbrowse' and 'onyx' as frontends to | ||||
|    PostgreSQL. Several contributions are working on tk based frontend | ||||
|    tools. Ask on the mailing list. | ||||
|     | ||||
|   3.7) How can I write client applications to PostgreSQL? | ||||
|   3.4) How can I write client applications to PostgreSQL? | ||||
|    | ||||
|    PostgreSQL supports a C-callable library interface called libpq as | ||||
|    well as a Tcl-based library interface called libtcl. | ||||
|    well as many others. See the /src/interfaces directory. | ||||
|     | ||||
|    Others have contributed a perl interface and a WWW gateway to | ||||
|    PostgreSQL. See the PostgreSQL home pages for more details. | ||||
|     | ||||
|   3.8) How do I prevent other hosts from accessing my PostgreSQL backend? | ||||
|    | ||||
|    Use host-based authentication by modifying the file $PGDATA/pg_hba | ||||
|    accordingly. | ||||
|     | ||||
|   3.9) How do I set up a pg_group? | ||||
|   3.5) How do I set up a pg_group? | ||||
|    | ||||
|    Currently, there is no easy interface to set up user groups. You have | ||||
|    to explicitly insert/update the pg_group table. For example: | ||||
| @ -446,7 +512,7 @@ Section 3: PostgreSQL Features | ||||
|      * grolist: the list of pg_user id's that belong in the group. This | ||||
|        is an int4[]. | ||||
|         | ||||
|   3.10) What is the exact difference between binary cursors and normal cursors? | ||||
|   3.6) What is the exact difference between binary cursors and normal cursors? | ||||
|    | ||||
|    Normal cursors return data back in ASCII format. Since data is stored | ||||
|    natively in binary format, the system must do a conversion to produce | ||||
| @ -467,14 +533,7 @@ Section 3: PostgreSQL Features | ||||
|    then getting it back in ASCII will save you some effort on the client | ||||
|    side. | ||||
|     | ||||
|   3.11) Why doesn't the != operator work? | ||||
|    | ||||
|    SQL specifies <> as the inequality operator, and that is what we have | ||||
|    defined for the built-in types. | ||||
|     | ||||
|    In 6.0, != is equivalent to <>. | ||||
|     | ||||
|   3.12) What is a R-tree index and what is it used for? | ||||
|   3.7) What is a R-tree index and what is it used for? | ||||
|    | ||||
|    An r-tree index is used for indexing spatial data. A hash index can't | ||||
|    handle range searches. A B-tree index only handles range searches in a | ||||
| @ -492,7 +551,12 @@ Section 3: PostgreSQL Features | ||||
|    You can also find this paper in Stonebraker's "Readings in Database | ||||
|    Systems" | ||||
|     | ||||
|   3.13) What is the maximum size for a tuple? | ||||
|    Builtin R-Trees can handle polygons and boxes. In theory, R-trees can | ||||
|    be extended to handle higher number of dimensions. In practice, | ||||
|    extending R-trees require a bit of work and we don't currently have | ||||
|    any documentation on how to do it. | ||||
|     | ||||
|   3.8) What is the maximum size for a tuple? | ||||
|    | ||||
|    Tuples are limited to 8K bytes. Taking into account system attributes | ||||
|    and other overhead, one should stay well shy of 8,000 bytes to be on | ||||
| @ -502,13 +566,14 @@ Section 3: PostgreSQL Features | ||||
|    Tuples do not cross 8k boundaries so a 5k tuple will require 8k of | ||||
|    storage. | ||||
|     | ||||
|   3.14) I defined indices but my queries don't seem to make use of them. Why? | ||||
|   3.9) I defined indices but my queries don't seem to make use of them. Why? | ||||
|    | ||||
|    PostgreSQL does not automatically maintain statistics. One has to make | ||||
|    an explicit 'vacuum' call to update the statistics. After statistics | ||||
|    are updated, the optimizer has a better shot at using indices. Note | ||||
|    that the optimizer is limited and does not use indices in some | ||||
|    circumstances (such as OR clauses). | ||||
|    circumstances (such as OR clauses). For column-specific optimization | ||||
|    statistics, use 'vacuum analyze'. | ||||
|     | ||||
|    If the system still does not see the index, it is probably because you | ||||
|    have created an index on a field with the improper *_ops type. For | ||||
| @ -522,36 +587,7 @@ Section 3: PostgreSQL Features | ||||
|     | ||||
|    Indexes not used for ORDER BY operations. | ||||
|     | ||||
|   3.15) Are there ODBC drivers for PostgreSQL? | ||||
|    | ||||
|    There are two ODBC drivers available, PostODBC and OpenLink ODBC. | ||||
|     | ||||
|    For all people being interested in PostODBC, there are now two mailing | ||||
|    lists devoted to the discussion of PostODBC. The mailing lists are: | ||||
|      * postodbc-users@listserv.direct. net | ||||
|      * postodbc-developers@listse rv.direct.net | ||||
|         | ||||
|    these lists are ordinary majordomo mailing lists. You can subscribe by | ||||
|    sending a mail to: | ||||
|      * majordomo@listserv.direct.net | ||||
|         | ||||
|    OpenLink ODBC is currently in beta under Linux. You can get it from | ||||
|    http://www.openlinksw.com/postgres.html. It works with our standard | ||||
|    ODBC client software so you'll have Postgres ODBC available on every | ||||
|    client platform we support (Win, Mac, Unix, VMS). | ||||
|     | ||||
|    We will probably be selling this product to people who need | ||||
|    commercial-quality support, but a freeware version will always be | ||||
|    available. Questions to postgres95@openlink.co.uk. | ||||
|     | ||||
|   3.16) How do I use postgres for multi-dimensional indexing (> 2 dimensions)? | ||||
|    | ||||
|    Builtin R-Trees can handle polygons and boxes. In theory, R-trees can | ||||
|    be extended to handle higher number of dimensions. In practice, | ||||
|    extending R-trees require a bit of work and we don't currently have | ||||
|    any documentation on how to do it. | ||||
|     | ||||
|   3.17) How do I do regular expression searches? case-insensitive regexp | ||||
|   3.10) How do I do regular expression searches? case-insensitive regexp | ||||
|   searching? | ||||
|    | ||||
|    PostgreSQL supports the SQL LIKE syntax as well as more general | ||||
| @ -559,14 +595,7 @@ Section 3: PostgreSQL Features | ||||
|    negated regexp operator. ~* and !~* are the case-insensitive regular | ||||
|    expression operators. | ||||
|     | ||||
|   3.18) I can't access the database as the 'root' user. | ||||
|    | ||||
|    You should not create database users with user id 0(root). They will | ||||
|    be unable to access the database. This is a security precaution | ||||
|    because of the ability of any user to dynamically link object modules | ||||
|    into the database engine. | ||||
|     | ||||
|   3.19) I experienced a server crash during a vacuum. How do I remove the lock | ||||
|   3.11) I experienced a server crash during a vacuum. How do I remove the lock | ||||
|   file? | ||||
|    | ||||
|    If the server crashes during a vacuum command, chances are it will | ||||
| @ -580,7 +609,7 @@ Section 3: PostgreSQL Features | ||||
|    file called "pg_vlock" in your database directory (which is | ||||
|    $PGDATA/base/<dbName>) | ||||
|     | ||||
|   3.20) What is the difference between the various character types? | ||||
|   3.12) What is the difference between the various character types? | ||||
|    | ||||
| Type            Internal Name   Notes | ||||
| -------------------------------------------------- | ||||
| @ -603,25 +632,25 @@ BYTEA           bytea           variable-length array of bytes | ||||
|    in the field. TEXT and BYTEA are the only character types that have | ||||
|    variable length on the disk. | ||||
|     | ||||
|   3.21) In a query, how do I detect if a field is NULL? | ||||
|   3.13) In a query, how do I detect if a field is NULL? | ||||
|    | ||||
|    PostgreSQL has two builtin keywords, "isnull" and "notnull" (note no | ||||
|    spaces). Version 1.05 and later and 6.* understand IS NULL and IS NOT | ||||
|    NULL. | ||||
|    You test the column with IS NULL and IS NOT NULL. | ||||
|     | ||||
|   3.22) How do I see how the query optimizer is evaluating my query? | ||||
|   3.14) How do I see how the query optimizer is evaluating my query? | ||||
|    | ||||
|    Place the word 'EXPLAIN' at the beginning of the query, for example: | ||||
| 
 | ||||
|         EXPLAIN SELECT * FROM table1 WHERE age = 23; | ||||
| 
 | ||||
|   3.23) How do I create a serial field? | ||||
|   3.15) How do I create a serial field? | ||||
|    | ||||
|    Postgres does not allow the user to specifiy a user column as type | ||||
|    SERIAL. Instead, you can use each row's oid field as a unique value. | ||||
|    However, if you need to dump and reload the database, you need to be | ||||
|    using postgres version 1.07 or later or 6.* with pgdump's -o option or | ||||
|    COPY's WITH OIDS option to preserver the oids. | ||||
|    However, if you need to dump and reload the database, you need to use | ||||
|    pgdump's -o option or COPY's WITH OIDS option to preserver the oids. | ||||
|     | ||||
|    We also have a SEQUENCE function that is similar to SERIAL. See the | ||||
|    create_sequence manual page. | ||||
|     | ||||
|    Another valid way of doing this is to create a function: | ||||
| 
 | ||||
| @ -641,92 +670,28 @@ BYTEA           bytea           variable-length array of bytes | ||||
|    could select the same new id. This statement should be performed | ||||
|    within a transaction. | ||||
|     | ||||
|    Sequences were implemented in 6.1 | ||||
|   3.16) What are the pg_psort.XXX files in my database directory? | ||||
|    | ||||
|   3.24) How do I create a multi-column index? | ||||
|    | ||||
|    In 6.0, you can not directly create a multi-column index using create | ||||
|    index. You need to define a function which acts on the multiple | ||||
|    columns, then use create index with that function. | ||||
|     | ||||
|    This feature is available in 6.1 and later releases. | ||||
|     | ||||
|   3.25) What are the temp_XXX files in my database directory? | ||||
|    | ||||
|    They are temp_ files generated by the query executor. For example, if | ||||
|    a sort needs to be done to satisfy an ORDER BY, some temp files are | ||||
|    generated as a result of the sort. | ||||
|    They are temporary sort files generated by the query executor. For | ||||
|    example, if a sort needs to be done to satisfy an ORDER BY, some temp | ||||
|    files are generated as a result of the sort. | ||||
|     | ||||
|    If you have no transactions or sorts running at the time, it is safe | ||||
|    to delete the temp_ files. | ||||
|    to delete the pg_psort.XXX files. | ||||
|     | ||||
|   3.26) Why are my table files not getting any smaller after a delete? | ||||
|    | ||||
|    If you run vacuum in pre-6.0, unused rows will be marked for reuse, | ||||
|    but the file blocks are not released. | ||||
|     | ||||
|    In 6.0, vacuum properly shrinks tables. | ||||
|     | ||||
|   3.27) Why can't I connect to my database from another machine? | ||||
|   3.17) Why can't I connect to my database from another machine? | ||||
|    | ||||
|    The default configuration allows only connections from tcp/ip host | ||||
|    localhost. You need to add a host entry to the file pgsql/data/pg_hba. | ||||
|     | ||||
|   3.28) I get the error 'default index class unsupported' when creating an | ||||
|   index. How do I do it? | ||||
|    | ||||
|    You probably used: | ||||
| 
 | ||||
|         create index idx1 on person using btree (name); | ||||
| 
 | ||||
|    PostgreSQL indexes are extensible, and therefore in pre-6.0, you must | ||||
|    specify a class_type when creating an index. Read the manual page for | ||||
|    create index (called create_index). | ||||
|     | ||||
|    Version 6.0, if you do not specify a class_type, it defaults to the | ||||
|    proper type for the column. | ||||
|     | ||||
|   3.29) Why does creating an index crash the backend server? | ||||
|    | ||||
|    You have probably defined an incorrect *_ops type class for the field | ||||
|    you are indexing. | ||||
|     | ||||
|   3.30) How do I find out what indexes or operations are defined in the | ||||
|   3.18) How do I find out what indexes or operations are defined in the | ||||
|   database? | ||||
|    | ||||
|    Run the file pgsql/src/tutorial/syscat.source. It illustrates many of | ||||
|    the 'select's needed to get information out of the database system | ||||
|    tables. | ||||
|     | ||||
|   3.31) Why do statements require an extra character at the end? Why does | ||||
|   'createuser' return 'unexpected last match in input()'? Why does pg_dump | ||||
|   fail? | ||||
|    | ||||
|    You have compile postgres with flex version 2.5.3. There is bug in | ||||
|    this version of flex. Use flex version 2.5.2 or flex 2.5.4 instead. | ||||
|    There is a doc/README.flex file which will properly patch the flex | ||||
|    2.5.3 source code. | ||||
|     | ||||
|   3.32) All my servers crash under concurrent table access. Why? | ||||
|    | ||||
|    This problem can be caused by a kernel that is not configured to | ||||
|    support semaphores. | ||||
|     | ||||
|   3.33) What tools are available for hooking postgres to Web pages? | ||||
|    | ||||
|    For web integration, PHP/FI is an excellent interface. The URL for | ||||
|    that is http://www.vex.net/php/ | ||||
|     | ||||
|    PHP is great for simple stuff, but for more complex stuff, some still | ||||
|    use the perl interface and CGI.pm. | ||||
|     | ||||
|    An example of using WWW with C to talk to Postgres is can be tried at: | ||||
|      * http://postgreSQL.org/~mlc | ||||
|         | ||||
|    An WWW gatway based on WDB using perl can be downloaded from: | ||||
|      * http://www.eol.ists.ca/~dunlop/wdb -p95 | ||||
|         | ||||
|   3.34) What is the time-warp feature and how does it relate to vacuum? | ||||
|   3.19) What is the time-warp feature and how does it relate to vacuum? | ||||
|    | ||||
|    PostgreSQL handles data changes differently than most database | ||||
|    systems. When a row is changed in a table, the original row is marked | ||||
| @ -755,61 +720,7 @@ BYTEA           bytea           variable-length array of bytes | ||||
|     | ||||
|    The time-travel feature will be removed in 7.0. | ||||
|     | ||||
|   3.35) How do I tune the database engine for better performance? | ||||
|    | ||||
|    There are two things that can be done. You can use Openlink's option | ||||
|    to disable fsync() by starting the postmaster with a '-o -F' option. | ||||
|    This will prevent fsync()'s from flushing to disk after every | ||||
|    transaction. | ||||
|     | ||||
|    You can also use the postmaster -B option to increase the number of | ||||
|    shared memory buffers shared among the backend processes. If you make | ||||
|    this parameter too high, the process will not start or crash | ||||
|    unexpectedly. Each buffer is 8K and the defualt is 64 buffers. | ||||
|     | ||||
|   3.36) What debugging features are available in PostgreSQL? | ||||
|    | ||||
|    PostgreSQL has several features that report status information that | ||||
|    can be valuable for debugging purposes. | ||||
|     | ||||
|    First, by compiling with DEBUG defined, many assert()'s monitor the | ||||
|    progress of the backend and halt the program when something unexpected | ||||
|    occurs. | ||||
|     | ||||
|    Both postmaster and postgres have several debug options available. | ||||
|    First, whenever you start the postmaster, make sure you send the | ||||
|    standard output and error to a log file, like: | ||||
| 
 | ||||
| 
 | ||||
|         cd /usr/local/pgsql | ||||
|         ./bin/postmaster >server.log 2>&1 & | ||||
| 
 | ||||
|    This will put a server.log file in the top-level PostgreSQL directory. | ||||
|    This file can contain useful information about problems or errors | ||||
|    encountered by the server. Postmaster has a -d option that allows even | ||||
|    more detailed information to be reported. The -d option takes a number | ||||
|    1-3 that specifies the debug level. The query plans in a verbose debug | ||||
|    file can be formatted using the 'indent' program. (You may need to | ||||
|    remove the '====' lines in 1.* releases.) Be warned that a debug level | ||||
|    greater than one generates large log files in 1.* releases. | ||||
|     | ||||
|    You can actuall run the postgres backend from the command line, and | ||||
|    type your SQL statement directly. This is recommended ONLY for | ||||
|    debugging purposes. Note that a newline terminates the query, not a | ||||
|    semicolon. If you have compiled with debugging symbols, you can | ||||
|    perhaps use a debugger to see what is happening. Because the backend | ||||
|    was not started from the postmaster, it is not running in an identical | ||||
|    environment and locking/backend interaction problems may not be | ||||
|    duplicated. Some operating system can attach to a running backend | ||||
|    directly to diagnose problems. | ||||
|     | ||||
|    The postgres program has a -s, -A, -t options that can be very usefull | ||||
|    for debugging and performance measurements. | ||||
|     | ||||
|    The EXPLAIN command (see this FAQ) allows you to see how PostgreSQL is | ||||
|    iterpreting your query. | ||||
|     | ||||
|   3.37) What is an oid? What is a tid? | ||||
|   3.20) What is an oid? What is a tid? | ||||
|    | ||||
|    Oids are Postgres's answer to unique row ids or serial columns. Every | ||||
|    row that is created in Postgres gets a unique oid. All oids generated | ||||
| @ -829,7 +740,7 @@ BYTEA           bytea           variable-length array of bytes | ||||
|    are used by index entries to point to physical rows. They can not be | ||||
|    accessed through sql. | ||||
|     | ||||
|   3.38) What is the meaning of some of the terms used in Postgres? | ||||
|   3.21) What is the meaning of some of the terms used in Postgres? | ||||
|    | ||||
|    Some of the source code and older documentation use terms that have | ||||
|    more common usage. Here are some: | ||||
| @ -845,7 +756,7 @@ BYTEA           bytea           variable-length array of bytes | ||||
|         | ||||
|    Please let me know if you think of any more. | ||||
|     | ||||
|   3.39) What is Genetic Query Optimization? | ||||
|   3.22) What is Genetic Query Optimization? | ||||
|    | ||||
|    The GEQO module in PostgreSQL is intended to solve the query | ||||
|    optimization problem of joining many tables by means of a Genetic | ||||
| @ -854,17 +765,15 @@ BYTEA           bytea           variable-length array of bytes | ||||
|     | ||||
|    For further information see README.GEQO <utesch@aut.tu-freiberg.de>. | ||||
|     | ||||
|   3.40) I am running Solaris and my dates display wrong. Why? | ||||
|   3.23) How do you remove a column from a table? | ||||
|    | ||||
|    There was a bug in 6.0 that caused this problem under Solaris with -O2 | ||||
|    optimization. Upgrade to 6.1.1. | ||||
|     | ||||
|   3.41) How do I enable more than 32 concurrent backends? | ||||
|    | ||||
|    Edit include/storage/sinvaladt.h, and change the value of | ||||
|    MaxBackendId. In the future, we plan to make this a configurable | ||||
|    prameter. | ||||
|    We do not support ALTER TABLE DROP COLUMN, but do this: | ||||
| 
 | ||||
|         SELECT ...  # select all columns but the one you want to remove | ||||
|         INTO TABLE new_table | ||||
|         FROM old_table; | ||||
|         DROP TABLE old_table; | ||||
|         ALTER TABLE new_table RENAME TO old_table; | ||||
|      _________________________________________________________________ | ||||
|     | ||||
| Section 4: Extending PostgreSQL | ||||
| @ -896,7 +805,6 @@ Section 4: Extending PostgreSQL | ||||
|    This requires extreme wizardry, so extreme that the authors have not | ||||
|    ever tried it, though in principle it can be done. The short answer is | ||||
|    ... you can't. This capability is forthcoming in the future. | ||||
|     | ||||
|      _________________________________________________________________ | ||||
|     | ||||
| Section 5: Bugs | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user