1999-06-04 17:50:44 +02:00
|
|
|
<refentry id="SQL-SET">
|
|
|
|
<refmeta>
|
|
|
|
<refentrytitle>
|
1999-05-20 07:40:27 +02:00
|
|
|
SET
|
1999-06-04 17:50:44 +02:00
|
|
|
</refentrytitle>
|
|
|
|
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
|
|
|
</refmeta>
|
|
|
|
<refnamediv>
|
1999-06-09 15:43:42 +02:00
|
|
|
<refname id="SQL-SET-TITLE">
|
1999-05-20 07:40:27 +02:00
|
|
|
SET
|
1999-06-04 17:50:44 +02:00
|
|
|
</refname>
|
|
|
|
<refpurpose>
|
1998-09-01 17:53:09 +02:00
|
|
|
Set run-time parameters for session
|
1999-06-04 17:50:44 +02:00
|
|
|
</refpurpose>
|
1999-05-20 07:40:27 +02:00
|
|
|
</refnamediv>
|
1999-06-04 17:50:44 +02:00
|
|
|
<refsynopsisdiv>
|
|
|
|
<refsynopsisdivinfo>
|
|
|
|
<date>1998-09-24</date>
|
|
|
|
</refsynopsisdivinfo>
|
|
|
|
<synopsis>
|
1999-06-14 09:37:05 +02:00
|
|
|
SET <replaceable class="PARAMETER">variable</replaceable> { TO | = } {
|
|
|
|
'<replaceable class="PARAMETER">value</replaceable>' | DEFAULT }
|
1999-06-04 17:50:44 +02:00
|
|
|
SET TIME ZONE { '<replaceable class="PARAMETER">timezone</replaceable>' | LOCAL | DEFAULT };
|
1999-06-08 22:01:01 +02:00
|
|
|
SET TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZED }
|
1999-06-04 17:50:44 +02:00
|
|
|
</synopsis>
|
1998-09-01 17:53:09 +02:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<refsect2 id="R2-SQL-SET-1">
|
|
|
|
<refsect2info>
|
|
|
|
<date>1998-09-24</date>
|
|
|
|
</refsect2info>
|
|
|
|
<title>
|
1999-05-20 07:40:27 +02:00
|
|
|
Inputs
|
1999-06-04 17:50:44 +02:00
|
|
|
</title>
|
|
|
|
<para>
|
1998-12-29 03:24:47 +01:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
<replaceable class="PARAMETER">variable</replaceable>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
1999-05-20 07:40:27 +02:00
|
|
|
<para>
|
|
|
|
Settable global parameter.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-06-04 17:50:44 +02:00
|
|
|
<replaceable class="PARAMETER">value</replaceable>
|
1999-05-20 07:40:27 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
1999-06-04 17:50:44 +02:00
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
New value of parameter.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
1999-06-04 17:50:44 +02:00
|
|
|
|
1999-05-20 07:40:27 +02:00
|
|
|
<para>
|
|
|
|
The possible variables and allowed values are:
|
1998-12-29 03:24:47 +01:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
CLIENT_ENCODING | NAMES
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Sets the multi-byte client encoding
|
1999-05-20 07:40:27 +02:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
<replaceable class="parameter">value</replaceable>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Sets the multi-byte client encoding to
|
|
|
|
<replaceable class="parameter">value</replaceable>.
|
|
|
|
The specified encoding must be supported by the backend.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
DEFAULT
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Sets the multi-byte client encoding.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
This is only enabled if multi-byte was specified to configure.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
DateStyle
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-05-20 07:40:27 +02:00
|
|
|
ISO
|
1999-06-04 17:50:44 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
use ISO 8601-style dates and times
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-06-04 17:50:44 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-05-20 07:40:27 +02:00
|
|
|
SQL
|
1999-06-04 17:50:44 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
use Oracle/Ingres-style dates and times
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-06-04 17:50:44 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-05-20 07:40:27 +02:00
|
|
|
Postgres
|
1999-06-04 17:50:44 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
use traditional <productname>Postgres</productname> format
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-06-04 17:50:44 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-05-20 07:40:27 +02:00
|
|
|
European
|
1999-06-04 17:50:44 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
use dd/mm/yyyy for numeric date representations.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-06-04 17:50:44 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-05-20 07:40:27 +02:00
|
|
|
NonEuropean
|
1999-06-04 17:50:44 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
use mm/dd/yyyy for numeric date representations.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-06-04 17:50:44 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-05-20 07:40:27 +02:00
|
|
|
German
|
1999-06-04 17:50:44 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
use dd.mm.yyyy for numeric date representations.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-06-04 17:50:44 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-05-20 07:40:27 +02:00
|
|
|
US
|
1999-06-04 17:50:44 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
same as 'NonEuropean'
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-06-04 17:50:44 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-05-20 07:40:27 +02:00
|
|
|
default
|
1999-06-04 17:50:44 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
restores the default values ('US,Postgres')
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
1999-06-04 17:50:44 +02:00
|
|
|
|
|
|
|
<para>
|
|
|
|
Date format initialization my be done by:
|
|
|
|
<simplelist>
|
|
|
|
<member>
|
|
|
|
Setting PGDATESTYLE environment variable.
|
|
|
|
</member>
|
|
|
|
<member>
|
|
|
|
Running postmaster using -oe parameter to set
|
|
|
|
dates to the 'European' convention.
|
|
|
|
Note that this affects only the some combinations of date styles; for example
|
|
|
|
the ISO style is not affected by this parameter.
|
|
|
|
</member>
|
|
|
|
<member>
|
|
|
|
Changing variables in
|
|
|
|
<filename>src/backend/utils/init/globals.c</filename>.
|
|
|
|
</member>
|
|
|
|
</simplelist>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The variables in <filename>globals.c</filename> which can be changed are:
|
|
|
|
<simplelist>
|
|
|
|
<member>
|
|
|
|
bool EuroDates = false | true
|
|
|
|
</member>
|
|
|
|
<member>
|
|
|
|
int DateStyle = USE_ISO_DATES | USE_POSTGRES_DATES | USE_SQL_DATES | USE_GERMAN_DATES
|
|
|
|
</member>
|
|
|
|
</simplelist>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
SERVER_ENCODING
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Sets the multi-byte server encoding
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
<replaceable class="parameter">value</replaceable>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Sets the multi-byte server encoding.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
DEFAULT
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Sets the multi-byte server encoding.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
This is only enabled if multi-byte was specified to configure.
|
|
|
|
</para>
|
1999-05-20 07:40:27 +02:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
TIMEZONE
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The possible values for timezone depends on your operating
|
|
|
|
system. For example on Linux /usr/lib/zoneinfo contains the
|
|
|
|
database of timezones.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Here are some valid values for timezone:
|
1998-12-29 03:24:47 +01:00
|
|
|
|
1999-05-20 07:40:27 +02:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
'PST8PDT'
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
set the timezone for California
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
'Portugal'
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
set time zone for Portugal.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
'Europe/Rome'
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
set time zone for Italy.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
DEFAULT
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
set time zone to your local timezone
|
|
|
|
(value of the TZ environment variable).
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
If an invalid time zone is specified, the time zone
|
|
|
|
becomes GMT (on most systems anyway).
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
A frontend which uses libpq may be initialized by setting the PGTZ
|
|
|
|
environment variable.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The second syntax shown above, allows one to set the timezone
|
|
|
|
with a syntax similar to SQL92 <command>SET TIME ZONE</command>.
|
|
|
|
The LOCAL keyword is just an alternate form
|
|
|
|
of DEFAULT for SQL92 compatibility.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-06-04 17:50:44 +02:00
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
TRANSACTION ISOLATION LEVEL
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Sets the isolation level for the current transaction.
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
READ COMMITTED
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-06-08 22:01:01 +02:00
|
|
|
The current transaction queries read only rows committed
|
|
|
|
before a query began. READ COMMITTED is the default.
|
1999-06-04 17:50:44 +02:00
|
|
|
</para>
|
1999-06-08 22:01:01 +02:00
|
|
|
|
|
|
|
<note>
|
1999-06-04 17:50:44 +02:00
|
|
|
<para>
|
1999-06-08 22:01:01 +02:00
|
|
|
<acronym>SQL92</acronym> standard requires
|
|
|
|
SERIALIZABLE to be the default isolation level.
|
1999-06-04 17:50:44 +02:00
|
|
|
</para>
|
1999-06-08 22:01:01 +02:00
|
|
|
</note>
|
1999-06-04 17:50:44 +02:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-06-08 22:01:01 +02:00
|
|
|
SERIALIZABLE
|
1999-06-04 17:50:44 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-06-08 22:01:01 +02:00
|
|
|
The current transaction queries read only rows committed
|
|
|
|
before first DML statement
|
|
|
|
(<command>SELECT/INSERT/DELETE/UPDATE/FETCH/COPY_TO</command>)
|
|
|
|
was executed in this transaction.
|
1999-06-04 17:50:44 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-06-08 22:01:01 +02:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-05-20 07:40:27 +02:00
|
|
|
</variablelist>
|
|
|
|
</para>
|
1999-06-04 17:50:44 +02:00
|
|
|
|
1999-05-20 07:40:27 +02:00
|
|
|
<para>
|
|
|
|
There are also several internal or optimization
|
|
|
|
parameters which can be specified
|
|
|
|
by the <command>SET</command> command:
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
COST_HEAP
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Sets the default cost of a heap scan for use by the optimizer.
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
<replaceable class="parameter">float4</replaceable>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Set the cost of a heap scan to the specified floating point value.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
DEFAULT
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Sets the cost of a heap scan to the default value.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The frontend may be initialized by setting the PGCOSTHEAP
|
|
|
|
environment variable.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-06-04 17:50:44 +02:00
|
|
|
|
1999-05-20 07:40:27 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-06-04 17:50:44 +02:00
|
|
|
COST_INDEX
|
1999-05-20 07:40:27 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-06-04 17:50:44 +02:00
|
|
|
Sets the default cost of an index scan for use by the optimizer.
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
<replaceable class="parameter">float4</replaceable>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Set the cost of an index scan to the specified floating point value.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
DEFAULT
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Sets the cost of an index scan to the default value.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
1999-05-20 07:40:27 +02:00
|
|
|
</para>
|
1999-06-04 17:50:44 +02:00
|
|
|
|
1999-05-20 07:40:27 +02:00
|
|
|
<para>
|
1999-06-04 17:50:44 +02:00
|
|
|
The frontend may be initialized by setting the PGCOSTINDEX
|
|
|
|
environment variable.
|
1999-05-20 07:40:27 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-06-03 20:18:43 +02:00
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-06-04 17:50:44 +02:00
|
|
|
GEQO
|
1999-06-03 20:18:43 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-06-04 17:50:44 +02:00
|
|
|
Sets the threshold for using the genetic optimizer algorithm.
|
|
|
|
|
1999-06-03 20:18:43 +02:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-06-04 17:50:44 +02:00
|
|
|
ON
|
1999-06-03 20:18:43 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-06-04 17:50:44 +02:00
|
|
|
enables the genetic optimizer algorithm
|
|
|
|
for statements with 6 or more tables.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
ON=<replaceable class="parameter">#</replaceable>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Takes an integer argument to enable the genetic optimizer algorithm
|
|
|
|
for statements with <replaceable class="parameter">#</replaceable>
|
|
|
|
or more tables in the query.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
OFF
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
disables the genetic optimizer algorithm.
|
1999-06-03 20:18:43 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
DEFAULT
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-06-04 17:50:44 +02:00
|
|
|
Equivalent to specifying <command>SET GEQO='ON'</command>
|
1999-06-03 20:18:43 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
1999-06-03 20:38:00 +02:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<para>
|
|
|
|
This algorithm is on by default, which used GEQO for
|
|
|
|
statements of eleven or more tables.
|
|
|
|
(See the chapter on GEQO in the Programmer's Guide
|
|
|
|
for more information).
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The frontend may be initialized by setting PGGEQO
|
|
|
|
environment variable.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
It may be useful when joining big relations with
|
|
|
|
small ones. This algorithm is off by default.
|
|
|
|
It's not used by GEQO anyway.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
1999-06-03 20:38:00 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-06-04 17:50:44 +02:00
|
|
|
KSQO
|
1999-06-03 20:38:00 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
1999-06-03 20:18:43 +02:00
|
|
|
<para>
|
1999-06-04 17:50:44 +02:00
|
|
|
<firstterm>Key Set Query Optimizer</firstterm> forces the query optimizer
|
|
|
|
to optimize repetative OR clauses such as generated by
|
|
|
|
<productname>MicroSoft Access</productname>:
|
|
|
|
|
1999-06-03 20:38:00 +02:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-06-04 17:50:44 +02:00
|
|
|
ON
|
1999-06-03 20:38:00 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-06-04 17:50:44 +02:00
|
|
|
enables this optimization.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
OFF
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
disables this optimization.
|
1999-06-03 20:38:00 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
DEFAULT
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-06-04 17:50:44 +02:00
|
|
|
Equivalent to specifying <command>SET KSQO='OFF'</command>.
|
1999-06-03 20:38:00 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
1999-06-04 17:50:44 +02:00
|
|
|
|
1999-06-03 20:38:00 +02:00
|
|
|
<para>
|
1999-06-04 17:50:44 +02:00
|
|
|
It may be useful when joining big relations with
|
|
|
|
small ones. This algorithm is off by default.
|
|
|
|
It's not used by GEQO anyway.
|
1999-06-03 20:38:00 +02:00
|
|
|
</para>
|
1999-06-04 17:50:44 +02:00
|
|
|
<para>
|
|
|
|
The frontend may be initialized by setting the PGKSQO
|
|
|
|
environment variable.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
1999-06-03 20:38:00 +02:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect2>
|
1999-06-03 20:18:43 +02:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<refsect2 id="R2-SQL-SET-2">
|
|
|
|
<refsect2info>
|
|
|
|
<date>1998-09-24</date>
|
|
|
|
</refsect2info>
|
|
|
|
<title>
|
1999-05-20 07:40:27 +02:00
|
|
|
Outputs
|
1999-06-04 17:50:44 +02:00
|
|
|
</title>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>
|
1999-05-20 07:40:27 +02:00
|
|
|
<returnvalue>SET VARIABLE</returnvalue>
|
1999-06-04 17:50:44 +02:00
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
Message returned if successfully.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term>
|
|
|
|
<returnvalue>WARN: Bad value for
|
|
|
|
<replaceable class="parameter">variable</replaceable>
|
|
|
|
(<replaceable class="parameter">value</replaceable>)</returnvalue>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If the command fails to set the specified variable.
|
1999-05-20 07:40:27 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
</variablelist>
|
1999-05-20 07:40:27 +02:00
|
|
|
</para>
|
1999-06-04 17:50:44 +02:00
|
|
|
</refsect2>
|
|
|
|
</refsynopsisdiv>
|
1999-05-20 07:40:27 +02:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<refsect1 id="R1-SQL-SET-1">
|
|
|
|
<refsect1info>
|
|
|
|
<date>1998-09-24</date>
|
|
|
|
</refsect1info>
|
|
|
|
<title>
|
1999-05-20 07:40:27 +02:00
|
|
|
Description
|
1999-06-04 17:50:44 +02:00
|
|
|
</title>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
<command>SET</command> will modify configuration parameters for variable during
|
|
|
|
a session.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Current values can be obtained using <command>SHOW</command>, and values
|
|
|
|
can be restored to the defaults using <command>RESET</command>.
|
|
|
|
Parameters and values are case-insensitive. Note that the value
|
|
|
|
field is always specified as a string, so is enclosed in
|
|
|
|
single-quotes.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<command>SET TIME ZONE</command> changes the session's
|
|
|
|
default time zone offset.
|
1999-06-04 17:50:44 +02:00
|
|
|
An SQL-session always begins with an initial default time zone
|
1999-05-20 07:40:27 +02:00
|
|
|
offset.
|
|
|
|
The <command>SET TIME ZONE</command> statement is used to change the default
|
|
|
|
time zone offset for the current SQL session.
|
|
|
|
</para>
|
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<refsect2 id="R2-SQL-SET-3">
|
|
|
|
<refsect2info>
|
|
|
|
<date>1998-09-24</date>
|
|
|
|
</refsect2info>
|
|
|
|
<title>
|
1999-05-20 07:40:27 +02:00
|
|
|
Notes
|
1999-06-04 17:50:44 +02:00
|
|
|
</title>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
The <command>SET <replaceable class="parameter">variable</replaceable></command>
|
|
|
|
statement is a <productname>Postgres</productname> language extension.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Refer to <command>SHOW</command> and <command>RESET</command> to
|
|
|
|
display or reset the current values.
|
|
|
|
</para>
|
1999-06-04 17:50:44 +02:00
|
|
|
</refsect2>
|
|
|
|
</refsect1>
|
1999-05-20 07:40:27 +02:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<refsect1 id="R1-SQL-SET-2">
|
|
|
|
<title>
|
1999-05-20 07:40:27 +02:00
|
|
|
Usage
|
1999-06-04 17:50:44 +02:00
|
|
|
</title>
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
<programlisting>
|
1999-05-20 07:40:27 +02:00
|
|
|
--Set the style of date to ISO:
|
|
|
|
--
|
|
|
|
SET DATESTYLE TO 'ISO';
|
|
|
|
</programlisting>
|
|
|
|
<programlisting>
|
|
|
|
--Enable GEQO for queries with 4 or more tables
|
|
|
|
--
|
|
|
|
SET GEQO ON=4;
|
|
|
|
</programlisting>
|
|
|
|
<programlisting>
|
|
|
|
--Set GEQO to default:
|
|
|
|
--
|
|
|
|
SET GEQO = DEFAULT;
|
|
|
|
</programlisting>
|
|
|
|
<programlisting>
|
|
|
|
--set the timezone for Berkeley, California:
|
|
|
|
SET TIME ZONE 'PST8PDT';
|
|
|
|
|
|
|
|
SELECT CURRENT_TIMESTAMP AS today;
|
|
|
|
|
|
|
|
today
|
|
|
|
----------------------
|
|
|
|
1998-03-31 07:41:21-08
|
|
|
|
</programlisting>
|
|
|
|
<programlisting>
|
|
|
|
--set the timezone for Italy:
|
|
|
|
SET TIME ZONE 'Europe/Rome';
|
|
|
|
|
|
|
|
SELECT CURRENT_TIMESTAMP AS today;
|
|
|
|
|
|
|
|
today
|
|
|
|
----------------------
|
|
|
|
1998-03-31 17:41:31+02
|
1999-06-04 17:50:44 +02:00
|
|
|
</programlisting>
|
1999-05-20 07:40:27 +02:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
</refsect1>
|
1998-12-29 03:24:47 +01:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<refsect1 id="R1-SQL-SET-3">
|
|
|
|
<title>
|
1999-05-20 07:40:27 +02:00
|
|
|
Compatibility
|
1999-06-04 17:50:44 +02:00
|
|
|
</title>
|
|
|
|
<para>
|
|
|
|
</para>
|
1999-05-20 07:40:27 +02:00
|
|
|
|
1999-06-04 17:50:44 +02:00
|
|
|
<refsect2 id="R2-SQL-SET-4">
|
|
|
|
<refsect2info>
|
|
|
|
<date>1998-09-24</date>
|
|
|
|
</refsect2info>
|
|
|
|
<title>
|
1999-05-20 07:40:27 +02:00
|
|
|
SQL92
|
1999-06-04 17:50:44 +02:00
|
|
|
</title>
|
|
|
|
<para>
|
1999-05-20 07:40:27 +02:00
|
|
|
There is no
|
|
|
|
<command>SET <replaceable class="parameter">variable</replaceable></command>
|
1999-06-08 22:01:01 +02:00
|
|
|
in <acronym>SQL92</acronym> (except for SET TRANSACTION ISOLATION LEVEL).
|
1999-05-20 07:40:27 +02:00
|
|
|
|
|
|
|
The <acronym>SQL92</acronym> syntax for <command>SET TIME ZONE</command>
|
|
|
|
is slightly different,
|
|
|
|
allowing only a single integer value for time zone specification:
|
|
|
|
|
|
|
|
<programlisting>
|
|
|
|
SET TIME ZONE { interval_value_expression | LOCAL }
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</refsect2>
|
|
|
|
</refsect1>
|
1999-06-04 17:50:44 +02:00
|
|
|
</refentry>
|
1999-05-20 07:40:27 +02:00
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:nil
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"../reference.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:"/usr/lib/sgml/CATALOG"
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
-->
|