📄 set.sgml
字号:
<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> <varlistentry> <term>COST_INDEX </term> <listitem> <para> 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> </para> <para> The frontend may be initialized by setting the PGCOSTINDEX environment variable. </para> </listitem> </varlistentry> <varlistentry> <term>GEQO </term> <listitem> <para> Sets the threshold for using the genetic optimizer algorithm. <variablelist> <varlistentry> <term>ON </term> <listitem> <para> 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. </para> </listitem> </varlistentry> <varlistentry> <term>DEFAULT </term> <listitem> <para> Equivalent to specifying <command>SET GEQO='ON'</command> </para> </listitem> </varlistentry> </variablelist> </para> <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> <varlistentry> <term>KSQO </term> <listitem> <para> <firstterm>Key Set Query Optimizer</firstterm> forces the query optimizer to optimize repetative OR clauses such as generated by <productname>MicroSoft Access</productname>: <variablelist> <varlistentry> <term>ON </term> <listitem> <para> enables this optimization. </para> </listitem> </varlistentry> <varlistentry> <term>OFF </term> <listitem> <para> disables this optimization. </para> </listitem> </varlistentry> <varlistentry> <term>DEFAULT </term> <listitem> <para> Equivalent to specifying <command>SET KSQO='OFF'</command>. </para> </listitem> </varlistentry> </variablelist> </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> <para> The frontend may be initialized by setting the PGKSQO environment variable. </para> </listitem> </varlistentry> </variablelist> </para> </refsect2> <refsect2 id="R2-SQL-SET-2"> <refsect2info> <date>1998-09-24</date> </refsect2info> <title> Outputs </title> <para> <variablelist> <varlistentry> <term><returnvalue>SET VARIABLE</returnvalue> </term> <listitem> <para> Message returned if successfully. </para> </listitem> </varlistentry> <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. </para> </listitem> </varlistentry> </variablelist> </para> </refsect2> </refsynopsisdiv> <refsect1 id="R1-SQL-SET-1"> <refsect1info> <date>1998-09-24</date> </refsect1info> <title> Description </title> <para> <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. An SQL-session always begins with an initial default time zone offset. The <command>SET TIME ZONE</command> statement is used to change the default time zone offset for the current SQL session. </para> <refsect2 id="R2-SQL-SET-3"> <refsect2info> <date>1998-09-24</date> </refsect2info> <title> Notes </title> <para> 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> </refsect2> </refsect1> <refsect1 id="R1-SQL-SET-2"> <title> Usage </title> <para> Set the style of date to ISO: <programlisting> SET DATESTYLE TO 'ISO'; </programlisting> Enable GEQO for queries with 4 or more tables: <programlisting> SET GEQO ON=4; </programlisting> Set GEQO to default: <programlisting> SET GEQO = DEFAULT; </programlisting> Set the timezone for Berkeley, California: <programlisting> SET TIME ZONE 'PST8PDT'; SELECT CURRENT_TIMESTAMP AS today; today ---------------------- 1998-03-31 07:41:21-08 </programlisting> Set the timezone for Italy: <programlisting> SET TIME ZONE 'Europe/Rome'; SELECT CURRENT_TIMESTAMP AS today; today ---------------------- 1998-03-31 17:41:31+02 </programlisting> </para> </refsect1> <refsect1 id="R1-SQL-SET-3"> <title> Compatibility </title> <para> </para> <refsect2 id="R2-SQL-SET-4"> <refsect2info> <date>1998-09-24</date> </refsect2info> <title> SQL92 </title> <para> There is no <command>SET <replaceable class="parameter">variable</replaceable></command> in <acronym>SQL92</acronym> (except for SET TRANSACTION ISOLATION LEVEL). 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></refentry><!-- Keep this comment at the end of the fileLocal variables:mode: sgmlsgml-omittag:nilsgml-shorttag:tsgml-minimize-attributes:nilsgml-always-quote-attributes:tsgml-indent-step:1sgml-indent-data:tsgml-parent-document:nilsgml-default-dtd-file:"../reference.ced"sgml-exposed-tags:nilsgml-local-catalogs:"/usr/lib/sgml/CATALOG"sgml-local-ecat-files:nilEnd:-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -