aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-01-11 20:12:43 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-01-11 20:12:43 +0000
commit782eefc580a503db4773cd177b17dcc6fd33b058 (patch)
tree047dfd54ec77992eb816e7b2250fec5f584eb1fb /doc/src
parentfb627b76ccc4c7074e37b6b94155864f6cbd1b23 (diff)
downloadpostgresql-782eefc580a503db4773cd177b17dcc6fd33b058.tar.gz
postgresql-782eefc580a503db4773cd177b17dcc6fd33b058.zip
Create a standard function pg_sleep() to sleep for a specified amount of time.
Replace the former ad-hoc implementation used in the regression tests. Joachim Wieland
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/func.sgml52
1 files changed, 51 insertions, 1 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index d90bc15d411..a3eadb4bc40 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.301 2005/12/28 01:29:58 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.302 2006/01/11 20:12:38 tgl Exp $
PostgreSQL documentation
-->
@@ -6170,6 +6170,56 @@ SELECT TIMESTAMP 'now'; -- incorrect for use with DEFAULT
</para>
</tip>
</sect2>
+
+ <sect2 id="functions-datetime-delay">
+ <title>Delaying Execution</title>
+
+ <indexterm>
+ <primary>pg_sleep</primary>
+ </indexterm>
+ <indexterm>
+ <primary>sleep</primary>
+ </indexterm>
+ <indexterm>
+ <primary>delay</primary>
+ </indexterm>
+
+ <para>
+ The following function is available to delay execution of the server
+ process:
+<synopsis>
+pg_sleep(<replaceable>seconds</replaceable>)
+</synopsis>
+
+ <function>pg_sleep</function> makes the current session's process
+ sleep until <replaceable>seconds</replaceable> seconds have
+ elapsed. <replaceable>seconds</replaceable> is a value of type
+ <type>double precision</>, so fractional-second delays can be specified.
+ For example:
+
+<programlisting>
+SELECT pg_sleep(1.5);
+</programlisting>
+ </para>
+
+ <note>
+ <para>
+ The effective resolution of the sleep interval is platform-specific;
+ 0.01 seconds is a common value. The sleep delay will be at least as long
+ as specified. It may be longer depending on factors such as server load.
+ </para>
+ </note>
+
+ <warning>
+ <para>
+ Make sure that your session does not hold more locks than necessary
+ when calling <function>pg_sleep</function>. Otherwise other sessions
+ might have to wait for your sleeping process, slowing down the entire
+ system.
+ </para>
+ </warning>
+ </sect2>
+
</sect1>