Frequently Asked Questions (FAQ) for PostgreSQL
- Last updated: Sat Jul 10 00:37:57 EDT 1999
+ Last updated: Wed Sep 1 19:26:40 EDT 1999
3.2) How do I install PostgreSQL somewhere other than
/usr/local/pgsql?
3.3) When I start the postmaster, I get a Bad System Call or core
- dumped message3. Why?
+ dumped message. Why?
3.4) When I try to start the postmaster, I get IpcMemoryCreate
errors3. Why?
3.5) When I try to start the postmaster, I get IpcSemaphoreCreate
4.19) Why do I get the error "FATAL: palloc failure: memory
exhausted?"
4.20) How do I tell what PostgreSQL version I am running?
+ 4.21) My large-object operations get invalid large obj descriptor.
+ Why?
Extending PostgreSQL
available for discussion of matters pertaining to PostgreSQL. To
subscribe, send a mail with the lines in the body (not the subject
line)
-
subscribe
end
There is also a digest list available. To subscribe to this list, send
-
subscribe
end
The bugs mailing list is available. To subscribe to this list, send
-
subscribe
end
with a BODY of:
-
subscribe
end
Features
PostgreSQL has most features present in large commercial
- DBMS's, like transactions, subselects, and sophisticated
- locking. We have some features they don't have, like
- user-defined types, inheritance, rules, and multi-version
+ DBMS's, like transactions, subselects, triggers, views, and
+ sophisticated locking. We have some features they don't have,
+ like user-defined types, inheritance, rules, and multi-version
concurrency control to reduce lock contention. We don't have
foreign key referential integrity or outer joins, but are
working on them for our next release.
Performance
PostgreSQL runs in two modes. Normal fsync mode flushes every
completed transaction to disk, guaranteeing that if the OS
- crashes or looses power in the next few seconds, all your data
+ crashes or loses power in the next few seconds, all your data
is safely stored on disk. In this mode, we are slower than most
commercial databases, partly because few of them do such
conservative flushing to disk in their default modes. In
no-fsync mode, we are usually faster than commercial databases,
though in this mode, an OS crash could cause data corruption.
We are working to provide an intermediate mode that suffers
- from less performance overhead than full fsync mode, and will
- allow data integrity within 30 seconds of an OS crash. The mode
- is select-able by the database administrator.
-
+ less performance overhead than full fsync mode, and will allow
+ data integrity within 30 seconds of an OS crash. The mode is
+ select-able by the database administrator.
In comparison to MySQL or leaner database systems, we are
- slower because we have transaction overhead. We are built for
- flexibility and features, not speed, though we continue to
- improve performance through profiling and source code analysis.
+ slower on inserts/updates because we have transaction overhead.
+ Of course, MySQL doesn't have any of the features mentioned in
+ the Features section above. We are built for flexibility and
+ features, though we continue to improve performance through
+ profiling and source code analysis.
+ We handle each user connection by creating a Unix process.
+ Backend processes share data buffers and locking information.
+ With multiple CPU's, multiple backends can easily run on
+ different CPU's.
Reliability
We realize that a DBMS must be reliable, or it is worthless. We
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 &
Currently, there is no easy interface to set up user groups. You have
to explicitly insert/update the pg_group table. For example:
-
jolly=> insert into pg_group (groname, grosysid, grolist)
jolly=> values ('posthackers', '1234', '{5443, 8261}');
INSERT 548224
4.5) 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
INTO TABLE new_table
FROM old_table;
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 the postmaster:
-
ulimit -d 65536
limit datasize 64m
4.20) 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?
+
+ You need to put BEGIN WORK and COMMIT around any use of a large object
+ handle, that is, surrounding lo_open ... lo_close.
+
+ The documentation has always stated that lo_open must be wrapped in a
+ transaction, but PostgreSQL versions prior to 6.5 didn't enforce that
+ rule. Instead, they'd just fail occasionally if you broke it.
+
+ Current PostgreSQL enforces the rule by closing large object handles
+ at transaction commit, which will be instantly upon completion of the
+ lo_open command if you are not inside a transaction. So the first
+ attempt to do anything with the handle will draw invalid large obj
+ descriptor. So code that used to work (at least most of the time) will
+ now generate that error message if you fail to use a transaction.
+
+ If you are using a client interface like ODBC you may need to set
+ auto-commit off.
_________________________________________________________________
Extending PostgreSQL
make_mkid make mkid ID files
mkldexport create AIX exports file
pgindent indents C source files
+ pginclude scripts for adding/removing include files
Let me note some of these. If you point your browser at the
file:/usr/local/src/pgsql/src/tools/backend/index.html directory, you
It auto-formats all source files to make them consistent. Comment
blocks that need specific line breaks should be formatted as block
comments, where the comment starts as /*------. These comments will
- not be reformatted in any way.
+ not be reformatted in any way. pginclude contains scripts used to add
+ needed #include's to include files, and removed unneeded #include's.
2) What books are good for developers?
Then, check src/include/port and add your new OS file, with
appropriate values. Hopefully, there is already locking code in
- src/include/storage/s_lock.h for your CPU. There is a backend/port
- directory if you need special files for your OS.
+ src/include/storage/s_lock.h for your CPU. There is also a
+ src/makefiles directory for port-specific Makefile handling. There is
+ a backend/port directory if you need special files for your OS.
TODO list for PostgreSQL
========================
-Last updated: Thu Jul 8 01:04:06 EDT 1999
+Last updated: Mon Sep 6 23:55:43 EDT 1999
* Alter TABLE ADD COLUMN does not honor DEFAULT, add CONSTRAINT
* Do not allow bpchar column creation without length
* Select a[1] FROM test fails, it needs test.a[1]
-* Array index references without table name cause problems
+* -Array index references without table name cause problems
* Update table SET table.value = 3 fails
* Creating index of TIMESTAMP & RELTIME fails, or rename to DATETIME(Thomas)
* SELECT foo UNION SELECT foo is incorrectly simplified to SELECT foo
-* INSERT ... SELECT ... GROUP BY groups by target columns not source columns
-* CREATE TABLE test (a char(5) DEFAULT text '', b int4) fails on INSERT
+* -INSERT ... SELECT ... GROUP BY groups by target columns not source columns
+* -CREATE TABLE test (a char(5) DEFAULT text '', b int4) fails on INSERT
* UNION with LIMIT fails
* Unique index on base column not honored on inserts from inherited table
INSERT INTO inherit_table (unique_index_col) VALUES (dup) should fail
-* CREATE TABLE x AS SELECT 1 UNION SELECT 2 fails
+* CREATE TABLE x AS SELECT 1 UNION SELECT 2 fails
+* CREATE TABLE test(col char(2) DEFAULT user) fails in length restriction
+* SELECT ... UNION ... ORDER BY fails when sort expr not in result list
+* Be smarter about promoting types when UNION merges different data types
+* SELECT ... UNION ... GROUP BY fails if column types disagree
+* redesign INSERT ... SELECT to have two levels of target list
+* -select * from pg_class where oid in (0,-1)
+* have INTERSECT/EXCEPT prevent duplicates unless ALL is specified
VIEWS
* User who can create databases can modify pg_database table
* Plpgsql does not handle quoted mixed-case identifiers
* Fix btree to give a useful elog when key > 1/2 (page - overhead)
+* pg_dump should preserve primary key information
ENHANCEMENTS
------------
* Remove Money type, add money formatting for decimal type
* Declare typein/out functions in pg_proc with a special "C string" data type
* Add non-large-object binary field
-* Add index on NUMERIC type
+* Add index on NUMERIC/DECIMAL type
+* Make Absolutetime/Relativetime int4 because time_t can be int8 on some ports
VIEWS
supplied ESCAPE
* Move LIKE index optimization handling to the optimizer
* Allow RULE recompilation
+* Support UNION/INTERSECT/EXCEPT in sub-selects
CLIENTS
* Make postgres user have a password by default
* Add configure test to check for C++ need for *.h and namespaces
* Allow BLCKSZ <= 64k, not <= 32k
+* redesign UNION structures to have separarate target lists
PERFORMANCE
-----------
* Create more system table indexes for faster cache lookups
* fix indexscan() so it does leak memory by not requiring caller to free
* Improve _bt_binsrch() to handle equal keys better, remove _bt_firsteq()(Tom)
+* Allow SELECT * FROM tab WHERE int2col = 4 use int2col index
+* Allow optimizer to prefer plans that match ORDER BY
CACHE
* Update pg_statistic table to remove operator column
* Allow char() not to use variable-sized header to reduce disk size
* Do async I/O to do better read-ahead of data
-* Fix memory exhaustion when using many OR's
+* -Fix memory exhaustion when using many OR's
when it is available
* Use mmap() rather than SYSV shared memory(?)
* Add use of 'const' for varibles in source tree
* Fix C optimizer problem where fmgr_ptr calls return different types
* Add needed includes and removed unneede include files(Bruce)
+* Make configure --enable-debug add -g on compile line
---------------------------------------------------------------------------