Wiki / psql Commands / Query execution
\watch
Repeatedly execute the current query buffer (as \g does) until interrupted, or the query fails, or the execution count limit (if given) is reached, or the query no longer returns the minimum number of rows. Wait the specified number of seconds (defa…
Reading PostgreSQL 18.6.
Description
Repeatedly execute the current query buffer (as \g does) until interrupted, or the query fails, or the execution count limit (if given) is reached, or the query no longer returns the minimum number of rows. Wait the specified number of seconds (default 2) between executions. The default wait can be changed with the variable WATCH_INTERVAL . For backwards compatibility, seconds can be specified with or without an interval= prefix. Each query result is displayed with a header that includes the \pset title string (if any), the time as of query start, and the delay interval.
- Client
- psql 18.6
- Case-sensitive spelling
- \watch
Usage
\watch [ i[nterval]= seconds ] [ c[ount]= times ] [ m[in_rows]= rows ] [ seconds ]Spellings in this manual definition
| Command | Documented suffix modifiers |
|---|---|
| \watch | None listed in this signature |
Manual definition
\watch [ i[nterval]=seconds] [ c[ount]=times] [ m[in_rows]=rows] [seconds]-
Repeatedly execute the current query buffer (as
\gdoes) until interrupted, or the query fails, or the execution count limit (if given) is reached, or the query no longer returns the minimum number of rows. Wait the specified number of seconds (default 2) between executions. The default wait can be changed with the variableWATCH_INTERVAL. For backwards compatibility,secondscan be specified with or without aninterval=prefix. Each query result is displayed with a header that includes the\pset titlestring (if any), the time as of query start, and the delay interval.If the current query buffer is empty, the most recently sent query is re-executed instead.
Related entries
Documentation and source
Source build
- Version
- 18.6
- Build
- https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
- Source fingerprint
ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8
Compare versions
PostgreSQL 17 → 18: changed.
--- PostgreSQL 17
+++ PostgreSQL 18
@@ -1,5 +1,5 @@
{
- "definition": "Repeatedly execute the current query buffer (as \\g does) until interrupted, or the query fails, or the execution count limit (if given) is reached, or the query no longer returns the minimum number of rows. Wait the specified number of seconds (default 2) between executions. For backwards compatibility, seconds can be specified with or without an interval= prefix. Each query result is displayed with a header that includes the \\pset title string (if any), the time as of query start, and the delay interval. If the current query buffer is empty, the most recently sent query is re-executed instead.",
+ "definition": "Repeatedly execute the current query buffer (as \\g does) until interrupted, or the query fails, or the execution count limit (if given) is reached, or the query no longer returns the minimum number of rows. Wait the specified number of seconds (default 2) between executions. The default wait can be changed with the variable WATCH_INTERVAL . For backwards compatibility, seconds can be specified with or without an interval= prefix. Each query result is displayed with a header that includes the \\pset title string (if any), the time as of query start, and the delay interval. If the current query buffer is empty, the most recently sent query is re-executed instead.",
"modifiers": [],
"signature": "\\watch [ i[nterval]= seconds ] [ c[ount]= times ] [ m[in_rows]= rows ] [ seconds ]",
"spellings": [
Compares recorded interfaces and attributes. Source fingerprints and build metadata are excluded; an absent sample is not proof of the introduction or removal release.
Related entries
Export JSON · Back to psql Commands · Recorded in PostgreSQL 10 through 20; the first sample is not necessarily its introduction.