It's possible to disable many
of the query planner's techniques, in hopes of avoiding a known bad type
of query. This is sometimes used as a work-around for the fact that
PostgreSQL doesn't support direct optimizer hints for how to execute a
query.
You might see the following code snippet, suggested as a way to force use of indexes instead of sequential scans for example:
enable_seqscan = off
Generally this is a bad idea, and you should improve the information the query optimizer is working with so it makes the right decisions instead.
Logging Parameter
General logging setup is important but it is somewhat outside the scope of this article. You may need to set parameters such as log_destination, log_directory, and log_filename to save your log files in a way compatible with the system administrations requirements of your environment. These will all be set to reasonable defaults to get started with on most systems.
On UNIX-like systems, it's common for some of the database logging to be set in the script that starts and stops the server, rather than directly in the postgresql.conf file. If you instead use the pg_ctlcommand to manually start the server, you may discover that logging ends up on your screen instead. You'll need to look at the script that starts the server normally (commonly /etc/init.d/postgresql) to determine what it does, if you want to duplicate that behavior. In most cases, you just need to add –l logfilename to the pg_ctl command line to redirect its output to the standard location.
