From: Bruce Momjian Last updated: Mon Mar 18 14:34:57 EST 2002 Last updated: Mon Sep 30 23:28:35 EDT 2002 Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us) The latest release of PostgreSQL is version 7.2.1. The latest release of PostgreSQL is version 7.2.3. We plan to have major releases every four months.Frequently Asked Questions (FAQ) for PostgreSQL
-
@@ -81,6 +81,8 @@
clients" when trying to connect?
3.9) What are the pg_sorttempNNN.NN
files in my database directory?
+ 3.10) Why do I need to do a dump and restore
+ to upgrade PostgreSQL releases?
Operational Questions
@@ -96,8 +98,8 @@
table, and a database?
4.6) How much database disk space is required
to store data from a typical text file?
- 4.7) How do I find out what tables or indexes
- are defined in the database?
+ 4.7) How do I find out what tables, indexes,
+ databases, and users are defined?
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
@@ -137,6 +139,10 @@
4.23) How do I perform an outer join?
4.24) How do I perform queries using multiple
databases?
+ 4.25) How do I return multiple rows or columns
+ from a function?
+ 4.26) Why can't I reliably create/drop
+ temporary tables in PL/PgSQL functions?
Extending PostgreSQL
@@ -276,6 +282,7 @@
subscribe
end
+
Digests are sent out to members of this list whenever the main list
has received around 30k of messages.
@@ -287,6 +294,7 @@
subscribe
end
+
There is also a developers discussion mailing list available. To
subscribe to this list, send email to pgsql-hackers-request@PostgreSQL.org
@@ -312,7 +320,7 @@
1.7) What is the latest release?
-
-
- In comparison to MySQL or leaner database systems, we are slower
- on inserts/updates because we have transaction overhead. Of
+
+ Features section above. We are built for reliability and
+ features, though we continue to improve performance in every
+ release. There is an interesting Web page comparing PostgreSQL to
+ MySQL at
+
+ http://openacs.org/why-not-mysql.html
-
- We handle each user connection by creating a Unix process.
- Backend processes share data buffers and locking information.
- With multiple CPUs, multiple backends can easily run on different
- CPUs.
Although the web page mentions PostgreSQL, Inc, the @@ -588,6 +583,10 @@
Additional interfaces are available at + http://www.postgresql.org/interfaces.html. +
You can also compile with profiling to see what functions are taking execution time. The backend profile files will be deposited in the pgsql/data/base/dbname directory. The client profile - file will be put in the client's current directory.
+ file will be put in the client's current directory. Linux requires + a compile with -DLINUX_PROFILE for proper profiling.The PostgreSQL team makes only small changes between minor releases, + so upgrading from 7.2 to 7.2.1 does not require a dump and restore. + However, major releases often change the internal format of system + tables and data files. These changes are often complex, so we don't + maintain backward compatability for data files. A dump outputs data + in a generic format that can then be loaded in using the new internal + format. + +
In releases where the on-disk format does not change, the + pg_upgrade script can be used to upgrade without a dump/restore. + The release notes mention whether pg_upgrade is available for the + release. +
We do not support ALTER TABLE DROP COLUMN, but do this:
+ BEGIN; + LOCK TABLE old_table; 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; + COMMIT;
These are the limits:
- Maximum size for a database? unlimited (500 GB databases exist) + Maximum size for a database? unlimited (1 TB databases exist) Maximum size for a table? 16 TB - Maximum size for a row? unlimited in 7.1 and later - Maximum size for a field? 1 GB in 7.1 and later + Maximum size for a row? 1.6TB + Maximum size for a field? 1 GB Maximum number of rows in a table? unlimited Maximum number of columns in a table? 250-1600 depending on column types Maximum number of indexes on a table? unlimited+ Of course, these are not actually unlimited, but limited to available disk space and memory/swap space. Performance may suffer when these values get unusually large. @@ -890,11 +911,16 @@
Indexes do not require as much overhead, but do contain the data that is being indexed, so they can be large also.
-NULLs are stored in bitmaps, so they + use very little space.
+ +psql has a variety of backslash commands to show such - information. Use \? to see them.
+ information. Use \? to see them. There are also system tables + beginning with pg_ that describe these too. Also, psql + -l will list all databases.Also try the file pgsql/src/tutorial/syscat.source. It illustrates many of the SELECTs needed to get @@ -905,7 +931,7 @@ Indexes are not automatically used by every query. Indexes are only used if the table is larger than a minimum size, and the query selects only a small percentage of the rows in the table. This is - because the random disk access caused by an index scan is sometimes + because the random disk access caused by an index scan can be slower than a straight read through the table, or sequential scan.
To determine if an index should be used, PostgreSQL must have @@ -922,13 +948,35 @@ usually faster than an index scan of a large table.
However, LIMIT combined with ORDER BY often will use an index because only a small portion of the table - is returned. + is returned. In fact, though MAX() and MIN() don't use indexes, + it is possible to retrieve such values using an index with ORDER BY + and LIMIT: ++ SELECT col + FROM tab + ORDER BY col [ DESC ] + LIMIT 1 +
When using wild-card operators such as LIKE or - ~, indexes can only be used if the beginning of the search - is anchored to the start of the string. Therefore, to use indexes, - LIKE patterns must not start with %, and - ~(regular expression) patterns must start with ^.
+ ~, indexes can only be used in certain circumstances: +
The ~ operator does regular expression matching, and ~* does case-insensitive regular expression matching. The case-insensitive variant of LIKE is called - ILIKE in PostgreSQL 7.1 and later.
+ ILIKE.Case-insensitive equality comparisons are normally expressed as:
@@ -983,13 +1031,12 @@ SELECT * FROM tab WHERE lower(col) = 'abc' - + This will not use an standard index. However, if you create a functional index, it will be used:CREATE INDEX tabindex on tab (lower(col)); -
CREATE SEQUENCE person_id_seq; @@ -1048,6 +1096,7 @@ BYTEA bytea variable-length byte array (null-byte safe) ); CREATE UNIQUE INDEX person_id_key ON person ( id );+ See the create_sequence manual page for more information about sequences. You can also use each row's OID field as a unique value. However, if you need to dump and reload the database, @@ -1066,6 +1115,7 @@ BYTEA bytea variable-length byte array (null-byte safe) new_id = output of "SELECT nextval('person_id_seq')" INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal'); + You would then also have the new value stored in
new_id
for use in other queries (e.g., as a foreign
key to the person
table). Note that the name of the
@@ -1081,6 +1131,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
INSERT INTO person (name) VALUES ('Blaise Pascal');
new_id = output of "SELECT currval('person_id_seq')";
+
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.
@@ -1180,14 +1231,14 @@ BYTEA bytea variable-length byte array (null-byte safe)
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 your system, or your kernel has a low limit for certain - resources. Try this before starting postmaster:
+You probably have run out of virtual memory on your system, + or your kernel has a low limit for certain resources. Try this + before starting postmaster:
ulimit -d 262144 limit datasize 256m+ Depending on your shell, only one of these may succeed, but it will set your process data segment limit much higher and perhaps allow the query to complete. This command applies to the current process, @@ -1246,12 +1297,13 @@ BYTEA bytea variable-length byte array (null-byte safe) WHERE EXISTS (SELECT col2 FROM TAB2 WHERE col1 = col2) + We hope to fix this limitation in a future release.
PostgreSQL 7.1 and later supports outer joins using the SQL - standard syntax. Here are two examples:
+PostgreSQL supports outer joins using the SQL standard syntax. + Here are two examples:
SELECT * FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col); @@ -1297,6 +1349,26 @@ BYTEA bytea variable-length byte array (null-byte safe)Of course, a client can make simultaneous connections to different databases and merge the information that way.
+ +4.25) How do I return multiple rows or + columns from a function?
+ +You can return result sets from PL/pgSQL functions using + refcursors. See + http://developer.postgresql.org/docs/postgres/plpgsql-cursors.html, + section 23.7.3.3.
+ +4.26) Why can't I reliably create/drop + temporary tables in PL/PgSQL functions?
+ PL/PgSQL caches function contents, and an unfortunate side effect + is that if a PL/PgSQL function accesses a temporary table, and that + table is later dropped and recreated, and the function called + again, the function will fail because the cached function contents + still point to the old temporary table. The solution is to use + EXECUTE for temporary table access in PL/PgSQL. This + will cause the query to be reparsed every time. +
Extending PostgreSQL
diff --git a/doc/src/sgml/version.sgml b/doc/src/sgml/version.sgml index 4d848aabdf2..cff149c4956 100644 --- a/doc/src/sgml/version.sgml +++ b/doc/src/sgml/version.sgml @@ -3,5 +3,5 @@ Update this file to propagate correct current version numbers to the documentation. In text, use for example &version; to refer to them. --> - + diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index e8f9158a04d..84a936e3082 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -3,8 +3,8 @@ /* * Parts of pg_config.h that you get with autoconf on other systems */ -#define PG_VERSION "7.2.2" -#define PG_VERSION_STR "7.2.2 (win32)" +#define PG_VERSION "7.2.3" +#define PG_VERSION_STR "7.2.3 (win32)" #define SYSCONFDIR "" diff --git a/src/interfaces/libpq++/libpq++dll.rc b/src/interfaces/libpq++/libpq++dll.rc index 4f342fcc0e9..6a21ff97d5f 100644 --- a/src/interfaces/libpq++/libpq++dll.rc +++ b/src/interfaces/libpq++/libpq++dll.rc @@ -1,8 +1,8 @@ #includeVS_VERSION_INFO VERSIONINFO - FILEVERSION 7,2,2,0 - PRODUCTVERSION 7,2,2,0 + FILEVERSION 7,2,3,0 + PRODUCTVERSION 7,2,3,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -16,14 +16,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", " \0" VALUE "FileDescription", "PostgreSQL C++ Access Library\0" - VALUE "FileVersion", "7, 2, 2, 0\0" + VALUE "FileVersion", "7, 2, 3, 0\0" VALUE "InternalName", "libpq++\0" VALUE "LegalCopyright", "Copyright © 2000\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "libpq++.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "PostgreSQL\0" - VALUE "ProductVersion", "7, 2, 2, 0\0" + VALUE "ProductVersion", "7, 2, 3, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/src/interfaces/libpq/libpq.rc b/src/interfaces/libpq/libpq.rc index 3ca9c56f821..f6d140e3aa5 100644 --- a/src/interfaces/libpq/libpq.rc +++ b/src/interfaces/libpq/libpq.rc @@ -1,8 +1,8 @@ #include VS_VERSION_INFO VERSIONINFO - FILEVERSION 7,2,2,0 - PRODUCTVERSION 7,2,2,0 + FILEVERSION 7,2,3,0 + PRODUCTVERSION 7,2,3,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0 FILEOS VOS__WINDOWS32 @@ -15,13 +15,13 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "PostgreSQL Access Library\0" - VALUE "FileVersion", "7, 2, 2, 0\0" + VALUE "FileVersion", "7, 2, 3, 0\0" VALUE "InternalName", "libpq\0" VALUE "LegalCopyright", "Copyright (C) 2000\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "libpq.dll\0" VALUE "ProductName", "PostgreSQL\0" - VALUE "ProductVersion", "7, 2, 2, 0\0" + VALUE "ProductVersion", "7, 2, 3, 0\0" END END BLOCK "VarFileInfo"