Book Image

PostgreSQL 9 Administration Cookbook - Second Edition

Book Image

PostgreSQL 9 Administration Cookbook - Second Edition

Overview of this book

Table of Contents (19 chapters)
PostgreSQL 9 Administration Cookbook Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Changing parameters in your programs


PostgreSQL allows you to set some parameter settings for each session or transaction.

How to do it…

You can change the value of a setting during your session, like this:

SET work_mem = '16MB';

This value will then be used for every future transaction. You can also change it only for the duration of the "current transaction":

SET LOCAL work_mem = '16MB';

The setting will last until you issue this command:

RESET work_mem;

Alternatively, you can issue the following command:

RESET ALL;

SET and RESET commands are SQL commands that can be issued from any interface. They apply only to PostgreSQL server parameters, but this does not mean that they affect the entire server. In fact, the parameters you can change with SET and RESET apply only to the current session. Also, note that there may be other parameters, such as JDBC driver parameters, that cannot be set in this way. Refer to the Connecting to the PostgreSQL server recipe in Chapter 1, First Steps, for help...