Database Reference
In-Depth Information
peer
Uses the client's OS name from the kernel. It is available only for Linux, BSD, Mac
OS X, and Solaris, and can be used only for local connections.
You can elect more than one authentication method, even for the same database. Just
keep in mind that pg_hba.conf is read from top to bottom.
Reloading the Configuration Files
Many, but not all, changes to configuration files require a restart of the postgres service.
Other changes take effect when you perform a reload, which won't kick out active con‐
nections. Open a console window and run this command to reload:
pg_ctl reload -D your_data_directory_here
Or, if you have PostgreSQL installed as a service in RedHat Enterprise Linux, CentOS,
or Ubuntu, enter instead:
service postgresql-9.3 reload
postgresql-9.3 is the name of your service. The service, particularly for older versions,
is sometimes just called postgresql sans the version number.
You can also log in as a superuser to any database and execute the following SQL:
SELECT pg_reload_conf ();
You can also reload from pgAdmin; see “Editing postgresql.conf and pg_hba.conf from
pgAdmin” on page 61 .
Managing Connections
Every once in a while, someone else (never you, of course) will execute a query that he
didn't intend to and end up hogging resources. You could also run into a query that's
taking much longer than what you have patience for. If one of these things happens,
you'll want to cancel the query on the connection or kill the connection altogether.
Furthermore, before you can perform a full backup or restore of a database or restore
a particular table that's in use, you'll need to kill all affected connections.
Keep in mind that killing is not a graceful end and should be used sparingly. Your client
application should catch queries that have gone haywire to begin with. Out of politeness,
you probably should inform the connected role that you're about to terminate its con‐
nection or do your dirty deed after hours when no one is around.
More often than we'd like, we find ourselves resorting to three SQL commands to cancel
running queries and terminate connections. Here is a typical sequence to follow:
1. Retrieve a listing of recent connections and process IDs:
Search WWH ::




Custom Search