Скачать в pdf «PostgreSQL»

If the postmaster is not running, you can actually 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 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.

If the postmaster is running, start psql in one window, then find the PID of the postgres process used by psql. Use a debugger to attach to the postgres PID. You can set breakpoints in the debugger and issue queries from psql. If you are debugging postgres start-up, you can set PGOPTIONS=»-W n», then start psql. This will cause start-up to delay for n seconds so you can attach with the debugger and trace through the start-up sequence.

The postgres program has -s, -A, and -t options that can be very useful for debugging and performance measurements.

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.

3.12)    I get “Sorry, too many clients” when trying to connect. Why?

You need to increase the postmaster’s limit on how many concurrent backend processes it can start.

In PostgreSQL 6.5 and up, the default limit is 32 processes. You can increase it by restarting the postmaster with a suitable -N value. With the default configuration you can set -N as large as 1024. If you need more, increase MAXBACKENDS in indude/canfig.h and rebuild. You can set the default value of -N at configuration time, if you like, using configured -with-maxbackends switch.

Скачать в pdf «PostgreSQL»