From 0b79ed27457bda0f2545257225923488ca72a453 Mon Sep 17 00:00:00 2001
From: Bruce Momjian
Date: Fri, 4 Jan 2002 05:44:45 +0000
Subject: [PATCH] Update FAQ.
---
doc/FAQ | 119 +++++++++++++++++++-----------------------
doc/src/FAQ/FAQ.html | 121 ++++++++++++++++++++-----------------------
2 files changed, 109 insertions(+), 131 deletions(-)
diff --git a/doc/FAQ b/doc/FAQ
index a441646996..7d821c59c4 100644
--- a/doc/FAQ
+++ b/doc/FAQ
@@ -1,7 +1,7 @@
Frequently Asked Questions (FAQ) for PostgreSQL
- Last updated: Wed Dec 5 00:41:12 EST 2001
+ Last updated: Fri Jan 4 00:44:42 EST 2002
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
@@ -58,42 +58,39 @@
Operational Questions
- 4.1) Why is the system confused about commas, decimal points, and date
- formats.
- 4.2) What is the exact difference between binary cursors and normal
- cursors?
- 4.3) How do I SELECT only the first few rows of a query?
- 4.4) How do I get a list of tables or other things I can see in psql?
- 4.5) How do you remove a column from a table?
- 4.6) What is the maximum size for a row, table, database?
- 4.7) How much database disk space is required to store data from a
+ 4.1) What is the difference between binary cursors and normal cursors?
+ 4.2) How do I SELECT only the first few rows of a query?
+ 4.3) How do I get a list of tables or other things I can see in psql?
+ 4.4) How do you remove a column from a table?
+ 4.5) What is the maximum size for a row, table, database?
+ 4.6) How much database disk space is required to store data from a
typical text file?
- 4.8) How do I find out what tables or indexes are defined in the
+ 4.7) How do I find out what tables or indexes are defined in the
database?
- 4.9) My queries are slow or don't make use of the indexes. Why?
- 4.10) How do I see how the query optimizer is evaluating my query?
- 4.11) What is an R-tree index?
- 4.12) What is the Genetic Query Optimizer?
- 4.13) How do I perform regular expression searches and
+ 4.8) My queries are slow or don't make use of the indexes. Why?
+ 4.9) How do I see how the query optimizer is evaluating my query?
+ 4.10) What is an R-tree index?
+ 4.11) What is the Genetic Query Optimizer?
+ 4.12) How do I perform regular expression searches and
case-insensitive regular expression searches? How do I use an index
for case-insensitive searches?
- 4.14) In a query, how do I detect if a field is NULL?
- 4.15) What is the difference between the various character types?
- 4.16.1) How do I create a serial/auto-incrementing field?
- 4.16.2) How do I get the value of a SERIAL insert?
- 4.16.3) Don't currval() and nextval() lead to a race condition with
+ 4.13) In a query, how do I detect if a field is NULL?
+ 4.14) What is the difference between the various character types?
+ 4.15.1) How do I create a serial/auto-incrementing field?
+ 4.15.2) How do I get the value of a SERIAL insert?
+ 4.15.3) Don't currval() and nextval() lead to a race condition with
other users?
- 4.17) What is an OID? What is a TID?
- 4.18) What is the meaning of some of the terms used in PostgreSQL?
- 4.19) Why do I get the error "ERROR: Memory exhausted in
+ 4.16) What is an OID? What is a TID?
+ 4.17) What is the meaning of some of the terms used in PostgreSQL?
+ 4.18) Why do I get the error "ERROR: Memory exhausted in
AllocSetAlloc()?"
- 4.20) How do I tell what PostgreSQL version I am running?
- 4.21) My large-object operations get invalid large obj descriptor.
+ 4.19) How do I tell what PostgreSQL version I am running?
+ 4.20) My large-object operations get invalid large obj descriptor.
Why?
- 4.22) How do I create a column that will default to the current time?
- 4.23) Why are my subqueries using IN so slow?
- 4.24) How do I perform an outer join?
- 4.25) How do I perform queries using multiple databases?
+ 4.21) How do I create a column that will default to the current time?
+ 4.22) Why are my subqueries using IN so slow?
+ 4.23) How do I perform an outer join?
+ 4.24) How do I perform queries using multiple databases?
Extending PostgreSQL
@@ -611,19 +608,11 @@
Operational Questions
- 4.1) Why is system confused about commas, decimal points, and date formats.
-
- Check your locale configuration. PostgreSQL uses the locale setting of
- the user that ran the postmaster process. There are postgres and psql
- SET commands to control the date format. Set those accordingly for
- your operating environment.
-
- 4.2) What is the exact difference between binary cursors and normal
- cursors?
+ 4.1) What is the difference between binary cursors and normal cursors?
See the DECLARE manual page for a description.
- 4.3) How do I SELECT only the first few rows of a query?
+ 4.2) How do I SELECT only the first few rows of a query?
See the FETCH manual page, or use SELECT ... LIMIT....
@@ -633,7 +622,7 @@
only the first few records requested, or the entire query may have to
be evaluated until the desired rows have been generated.
- 4.4) How do I get a list of tables or other things I can see in psql?
+ 4.3) How do I get a list of tables or other things I can see in psql?
You can read the source code for psql in file
pgsql/src/bin/psql/describe.c. It contains SQL commands that generate
@@ -641,7 +630,7 @@
the -E option so it will print out the queries it uses to execute the
commands you give.
- 4.5) How do you remove a column from a table?
+ 4.4) How do you remove a column from a table?
We do not support ALTER TABLE DROP COLUMN, but do this:
SELECT ... -- select all columns but the one you want to remove
@@ -650,7 +639,7 @@
DROP TABLE old_table;
ALTER TABLE new_table RENAME TO old_table;
- 4.6) What is the maximum size for a row, table, database?
+ 4.5) What is the maximum size for a row, table, database?
These are the limits:
Maximum size for a database? unlimited (60GB databases exist)
@@ -672,7 +661,7 @@
The maximum table size and maximum number of columns can be increased
if the default block size is increased to 32k.
- 4.7) 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?
A PostgreSQL database may need six-and-a-half times the disk space
@@ -702,7 +691,7 @@
Indexes do not require as much overhead, but do contain the data that
is being indexed, so they can be large also.
- 4.8) How do I find out what tables or indexes are defined in the database?
+ 4.7) How do I find out what tables or indexes are defined in the database?
psql has a variety of backslash commands to show such information. Use
\? to see them.
@@ -711,7 +700,7 @@
many of the SELECTs needed to get information from the database system
tables.
- 4.9) My queries are slow or don't make use of the indexes. Why?
+ 4.8) My queries are slow or don't make use of the indexes. Why?
PostgreSQL does not automatically maintain statistics. VACUUM must be
run to update the statistics. After statistics are updated, the
@@ -736,11 +725,11 @@
string. So, to use indices, LIKE searches should not begin with %, and
~(regular expression searches) should start with ^.
- 4.10) How do I see how the query optimizer is evaluating my query?
+ 4.9) How do I see how the query optimizer is evaluating my query?
See the EXPLAIN manual page.
- 4.11) What is an R-tree index?
+ 4.10) What is an R-tree index?
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
@@ -763,13 +752,13 @@
extending R-trees requires a bit of work and we don't currently have
any documentation on how to do it.
- 4.12) What is the Genetic Query Optimizer?
+ 4.11) What is the Genetic Query Optimizer?
The GEQO module speeds query optimization when joining many tables by
means of a Genetic Algorithm (GA). It allows the handling of large
join queries through nonexhaustive search.
- 4.13) How do I perform regular expression searches and case-insensitive
+ 4.12) How do I perform regular expression searches and case-insensitive
regular expression searches? How do I use an index for case-insensitive
searches?
@@ -788,11 +777,11 @@
CREATE INDEX tabindex on tab (lower(col));
- 4.14) In a query, how do I detect if a field is NULL?
+ 4.13) In a query, how do I detect if a field is NULL?
You test the column with IS NULLIS NOT NULL.
- 4.15) What is the difference between the various character types?
+ 4.14) What is the difference between the various character types?
Type Internal Name Notes
--------------------------------------------------
@@ -817,7 +806,7 @@ BYTEA bytea variable-length byte array (null-safe)
maximum 1 gigabyte. BYTEA is for storing binary data, particularly
values that include NULL bytes.
- 4.16.1) How do I create a serial/auto-incrementing field?
+ 4.15.1) How do I create a serial/auto-incrementing field?
PostgreSQL supports a SERIAL data type. It auto-creates a sequence and
index on the column. For example, this:
@@ -841,11 +830,11 @@ BYTEA bytea variable-length byte array (null-safe)
Numbering Rows.
- 4.16.2) How do I get the value of a SERIAL insert?
+ 4.15.2) How do I get the value of a SERIAL insert?
One approach is to to retrieve the next SERIAL value from the sequence
object with the nextval() function before inserting and then insert it
- explicitly. Using the example table in 4.16.1, that might look like
+ explicitly. Using the example table in 4.15.1, that might look like
this in Perl:
new_id = output of "SELECT nextval('person_id_seq')"
INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal');
@@ -867,13 +856,13 @@ BYTEA bytea variable-length byte array (null-safe)
oid value is made available via $sth->{pg_oid_status} after
$sth->execute().
- 4.16.3) Don't currval() and nextval() lead to a race condition with other
+ 4.15.3) Don't currval() and nextval() lead to a race condition with other
users?
No. Currval() returns the current value assigned by your backend, not
by all users.
- 4.17) What is an OID? What is a TID?
+ 4.16) What is an OID? What is a TID?
OIDs are PostgreSQL's answer to unique row ids. Every row that is
created in PostgreSQL gets a unique OID. All OIDs generated during
@@ -906,7 +895,7 @@ BYTEA bytea variable-length byte array (null-safe)
values. Tids change after rows are modified or reloaded. They are used
by index entries to point to physical rows.
- 4.18) What is the meaning of some of the terms used in PostgreSQL?
+ 4.17) What is the meaning of some of the terms used in PostgreSQL?
Some of the source code and older documentation use terms that have
more common usage. Here are some:
@@ -923,7 +912,7 @@ BYTEA bytea variable-length byte array (null-safe)
A list of general database terms can be found at:
http://www.comptechnews.com/~reaster/dbdesign.html
- 4.19) Why do I get the error "ERROR: Memory exhausted in AllocSetAlloc()?"
+ 4.18) Why do I get the error "ERROR: Memory exhausted in AllocSetAlloc()?"
If you are running a version older than 7.1, an upgrade may fix the
problem. Also it is possible you have run out of virtual memory on
@@ -939,11 +928,11 @@ BYTEA bytea variable-length byte array (null-safe)
problem with the SQL client because the backend is returning too much
data, try it before starting the client.
- 4.20) How do I tell what PostgreSQL version I am running?
+ 4.19) How do I tell what PostgreSQL version I am running?
From psql, type select version();
- 4.21) My large-object operations get invalid large obj descriptor. Why?
+ 4.20) My large-object operations get invalid large obj descriptor. Why?
You need to put BEGIN WORK and COMMIT around any use of a large object
handle, that is, surrounding lo_open ... lo_close.
@@ -957,12 +946,12 @@ BYTEA bytea variable-length byte array (null-safe)
If you are using a client interface like ODBC you may need to set
auto-commit off.
- 4.22) How do I create a column that will default to the current time?
+ 4.21) How do I create a column that will default to the current time?
Use CURRENT_TIMESTAMP:
CREATE TABLE test (x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP );
- 4.23) Why are my subqueries using IN so slow?
+ 4.22) Why are my subqueries using IN so slow?
Currently, we join subqueries to outer queries by sequentially
scanning the result of the subquery for each row of the outer query. A
@@ -978,7 +967,7 @@ SELECT *
We hope to fix this limitation in a future release.
- 4.24) How do I perform an outer join?
+ 4.23) How do I perform an outer join?
PostgreSQL 7.1 and later supports outer joins using the SQL standard
syntax. Here are two examples:
@@ -1008,7 +997,7 @@ SELECT *
WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2)
ORDER BY col1
- 4.25) How do I perform queries using multiple databases?
+ 4.24) How do I perform queries using multiple databases?
There is no way to query any database except the current one. Because
PostgreSQL loads database-specific system catalogs, it is uncertain
diff --git a/doc/src/FAQ/FAQ.html b/doc/src/FAQ/FAQ.html
index dd5eb71073..1133ab77d2 100644
--- a/doc/src/FAQ/FAQ.html
+++ b/doc/src/FAQ/FAQ.html
@@ -11,7 +11,7 @@
alink="#0000FF">
Frequently Asked Questions (FAQ) for PostgreSQL
- Last updated: Wed Dec 5 00:41:12 EST 2001
+ Last updated: Fri Jan 4 00:44:42 EST 2002
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
@@ -89,57 +89,55 @@
Operational Questions
- 4.1) Why is the system confused about commas,
- decimal points, and date formats.
- 4.2) What is the exact difference between
+ 4.1) What is the difference between
binary cursors and normal cursors?
- 4.3) How do I SELECT only the
+ 4.2) How do I SELECT only the
first few rows of a query?
- 4.4) How do I get a list of tables or other
+ 4.3) How do I get a list of tables or other
things I can see in psql?
- 4.5) How do you remove a column from a
+ 4.4) How do you remove a column from a
table?
- 4.6) What is the maximum size for a row, table,
+ 4.5) What is the maximum size for a row, table,
database?
- 4.7) How much database disk space is required
+ 4.6) How much database disk space is required
to store data from a typical text file?
- 4.8) How do I find out what tables or indexes
+ 4.7) How do I find out what tables or indexes
are defined in the database?
- 4.9) My queries are slow or don't make use of
+ 4.8) My queries are slow or don't make use of
the indexes. Why?
- 4.10) How do I see how the query optimizer is
+ 4.9) How do I see how the query optimizer is
evaluating my query?
- 4.11) What is an R-tree index?
- 4.12) What is the Genetic Query Optimizer?
- 4.13) How do I perform regular expression
+ 4.10) What is an R-tree index?
+ 4.11) What is the Genetic Query Optimizer?
+ 4.12) How do I perform regular expression
searches and case-insensitive regular expression searches? How do I
use an index for case-insensitive searches?
- 4.14) In a query, how do I detect if a field
+ 4.13) In a query, how do I detect if a field
is NULL?
- 4.15) What is the difference between the
+ 4.14) What is the difference between the
various character types?
- 4.16.1) How do I create a
+ 4.15.1) How do I create a
serial/auto-incrementing field?
- 4.16.2) How do I get the value of a
+ 4.15.2) How do I get the value of a
SERIAL insert?
- 4.16.3) Don't currval() and
+ 4.15.3) Don't currval() and
nextval() lead to a race condition with other users?
- 4.17) What is an OID? What is a
+ 4.16) What is an OID? What is a
TID?
- 4.18) What is the meaning of some of the terms
+ 4.17) What is the meaning of some of the terms
used in PostgreSQL?
- 4.19) Why do I get the error "ERROR:
+ 4.18) Why do I get the error "ERROR:
Memory exhausted in AllocSetAlloc()?"
- 4.20) How do I tell what PostgreSQL version I
+ 4.19) How do I tell what PostgreSQL version I
am running?
- 4.21) My large-object operations get
+ 4.20) My large-object operations get
invalid large obj descriptor. Why?
- 4.22) How do I create a column that will
+ 4.21) How do I create a column that will
default to the current time?
- 4.23) Why are my subqueries using
+ 4.22) Why are my subqueries using
IN
so slow?
- 4.24) How do I perform an outer join?
- 4.25) How do I perform queries using multiple databases?
+ 4.23) How do I perform an outer join?
+ 4.24) How do I perform queries using multiple databases?
@@ -788,22 +786,13 @@
Operational Questions
- 4.1) Why is system confused about commas,
- decimal points, and date formats.
-
- Check your locale configuration. PostgreSQL uses the locale
- setting of the user that ran the postmaster process. There
- are postgres and psql SET commands to control the
- date format. Set those accordingly for your operating
- environment.
-
- 4.2) What is the exact difference between
+ 4.1) What is the difference between
binary cursors and normal cursors?
See the DECLARE manual page for a
description.
- 4.3) How do I SELECT only the
+ 4.2) How do I SELECT only the
first few rows of a query?
See the FETCH manual page, or use
@@ -816,7 +805,7 @@
records requested, or the entire query may have to be evaluated
until the desired rows have been generated.
- 4.4) How do I get a list of tables or other
+ 4.3) How do I get a list of tables or other
things I can see in psql?
@@ -827,7 +816,7 @@
-E option so it will print out the queries it uses to
execute the commands you give.
- 4.5) How do you remove a column from a
+ 4.4) How do you remove a column from a
table?
We do not support ALTER TABLE DROP COLUMN, but do
@@ -840,7 +829,7 @@
ALTER TABLE new_table RENAME TO old_table;
-
4.6) What is the maximum size for a row,
+ 4.5) What is the maximum size for a row,
table, database?
These are the limits:
@@ -864,7 +853,7 @@
The maximum table size and maximum number of columns can be
increased if the default block size is increased to 32k.
- 4.7) How much database disk space is required
+ 4.6) How much database disk space is required
to store data from a typical text file?
@@ -897,7 +886,7 @@
Indexes do not require as much overhead, but do contain the data
that is being indexed, so they can be large also.
- 4.8) How do I find out what tables or indexes
+ 4.7) How do I find out what tables or indexes
are defined in the database?
psql has a variety of backslash commands to show such
@@ -907,7 +896,7 @@
illustrates many of the SELECTs needed to get
information from the database system tables.
- 4.9) My queries are slow or don't make use of
+ 4.8) My queries are slow or don't make use of
the indexes. Why?
PostgreSQL does not automatically maintain statistics.
@@ -937,12 +926,12 @@
~(regular expression searches) should start with
^.
- 4.10) How do I see how the query optimizer
+ 4.9) How do I see how the query optimizer
is evaluating my query?
See the EXPLAIN manual page.
- 4.11) What is an R-tree index?
+ 4.10) What is an R-tree index?
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
@@ -967,7 +956,7 @@
practice, extending R-trees requires a bit of work and we don't
currently have any documentation on how to do it.
- 4.12) What is the Genetic Query
+ 4.11) What is the Genetic Query
Optimizer?
The GEQO module speeds query optimization when
@@ -975,7 +964,7 @@
the handling of large join queries through nonexhaustive
search.
- 4.13) How do I perform regular expression
+ 4.12) How do I perform regular expression
searches and case-insensitive regular expression searches? How do I
use an index for case-insensitive searches?
@@ -999,12 +988,12 @@
CREATE INDEX tabindex on tab (lower(col));
- 4.14) In a query, how do I detect if a field
+ 4.13) In a query, how do I detect if a field
is NULL?
You test the column with IS NULLIS NOT NULL.
- 4.15) What is the difference between the
+ 4.14) What is the difference between the
various character types?
Type Internal Name Notes
@@ -1034,7 +1023,7 @@ BYTEA bytea variable-length byte array (null-safe)
binary data, particularly values that include NULL
bytes.
- 4.16.1) How do I create a
+ 4.15.1) How do I create a
serial/auto-incrementing field?
PostgreSQL supports a SERIAL data type. It
@@ -1064,13 +1053,13 @@ BYTEA bytea variable-length byte array (null-safe)
Numbering
Rows.
- 4.16.2) How do I get the value of a
+ 4.15.2) How do I get the value of a
SERIAL insert?
One approach is to to retrieve the next SERIAL
value from the sequence object with the nextval() function
before inserting and then insert it explicitly. Using the
- example table in 4.16.1, that might look like
+ example table in 4.15.1, that might look like
this in Perl:
new_id = output of "SELECT nextval('person_id_seq')"
@@ -1091,20 +1080,20 @@ BYTEA bytea variable-length byte array (null-safe)
INSERT INTO person (name) VALUES ('Blaise Pascal');
new_id = output of "SELECT currval('person_id_seq')";
- Finally, you could use the OID
+ Finally, you could use the OID
returned from the INSERT statement to look up the
default value, though this is probably the least portable approach.
In Perl, using DBI with Edmund Mergl's DBD::Pg module, the oid
value is made available via $sth->{pg_oid_status} after
$sth->execute().
- 4.16.3) Don't currval() and
+ 4.15.3) Don't currval() and
nextval() lead to a race condition with other users?
No. Currval() returns the current value assigned by your
backend, not by all users.
- 4.17) What is an OID? What is
+ 4.16) What is an OID? What is
a TID?
OIDs are PostgreSQL's answer to unique row ids.
@@ -1149,7 +1138,7 @@ BYTEA bytea variable-length byte array (null-safe)
or reloaded. They are used by index entries to point to physical
rows.
- 4.18) What is the meaning of some of the
+ 4.17) What is the meaning of some of the
terms used in PostgreSQL?
Some of the source code and older documentation use terms that
@@ -1178,7 +1167,7 @@ BYTEA bytea variable-length byte array (null-safe)
A list of general database terms can be found at: http://www.comptechnews.com/~reaster/dbdesign.html
- 4.19) Why do I get the error "ERROR:
+ 4.18) Why do I get the error "ERROR:
Memory exhausted in AllocSetAlloc()?"
@@ -1198,13 +1187,13 @@ BYTEA bytea variable-length byte array (null-safe)
backend is returning too much data, try it before starting the
client.
- 4.20) How do I tell what PostgreSQL version
+ 4.19) How do I tell what PostgreSQL version
I am running?
From psql, type select version();
- 4.21) My large-object operations get
+ 4.20) My large-object operations get
invalid large obj descriptor. Why?
@@ -1221,7 +1210,7 @@ BYTEA bytea variable-length byte array (null-safe)
If you are using a client interface like ODBC you
may need to set auto-commit off.
- 4.22) How do I create a column that will
+ 4.21) How do I create a column that will
default to the current time?
@@ -1231,7 +1220,7 @@ BYTEA bytea variable-length byte array (null-safe)
- 4.23) Why are my subqueries using
+ 4.22) Why are my subqueries using
IN
so slow?
@@ -1254,7 +1243,7 @@ BYTEA bytea variable-length byte array (null-safe)
We hope to fix this limitation in a future release.
- 4.24) How do I perform an outer join?
+ 4.23) How do I perform an outer join?
PostgreSQL 7.1 and later supports outer joins using the SQL
@@ -1295,7 +1284,7 @@ BYTEA bytea variable-length byte array (null-safe)
ORDER BY col1
-
4.25) How do I perform queries
+ 4.24) How do I perform queries
using multiple databases?
There is no way to query any database except the current one.
--
2.40.0