1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Clarify STABLE function documentation to highlight how such functions

can be optimized.
This commit is contained in:
Bruce Momjian
2006-01-19 22:52:20 +00:00
parent 337cc41236
commit b148ce8a4a

View File

@ -1,5 +1,5 @@
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.107 2005/10/15 20:12:33 neilc Exp $ $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.107.2.1 2006/01/19 22:52:20 momjian Exp $
--> -->
<sect1 id="xfunc"> <sect1 id="xfunc">
@ -899,13 +899,13 @@ CREATE FUNCTION test(int, int) RETURNS int
<para> <para>
A <literal>STABLE</> function cannot modify the database and is A <literal>STABLE</> function cannot modify the database and is
guaranteed to return the same results given the same arguments guaranteed to return the same results given the same arguments
for all calls within a single surrounding query. This category for all rows within a single statement. This category allows the
allows the optimizer to optimize away multiple calls of the function optimizer to optimize multiple calls of the function to a single
within a single query. In particular, it is safe to use an expression call. In particular, it is safe to use an expression containing
containing such a function in an index scan condition. (Since an such a function in an index scan condition. (Since an index scan
index scan will evaluate the comparison value only once, not once at will evaluate the comparison value only once, not once at each
each row, it is not valid to use a <literal>VOLATILE</> function in row, it is not valid to use a <literal>VOLATILE</> function in an
an index scan condition.) index scan condition.)
</para> </para>
</listitem> </listitem>
<listitem> <listitem>