SET SESSION RUNTIMECAP
Sets the maximum amount of time queries and stored procedures can run in a given session. If a query or stored procedure exceeds its session's RUNTIMECAP
, Vertica terminates it and returns an error. You cannot increase the RUNTIMECAP
beyond the limit that is set in your user profile.
Note
Vertica does not strictly enforce sessionRUNTIMECAP
settings. If you time a query or stored procedure, you might discover that it runs longer than the RUNTIMECAP
setting.
Syntax
SET SESSION RUNTIMECAP duration
Parameters
duration
- Specifies how long a given query can run in the current session, one of the following:
-
NONE
(default): Removes a runtime limit for all current session queries. -
'
interval
'
: Specifies as an interval the maximum runtime for current session queries, up to one year—for example,1 minute
or100 seconds
. -
=DEFAULT
: Sets maximum runtime for queries in this session to the user'sRUNTIMECAP
value.
-
Privileges
-
Superusers can increase session
RUNTIMECAP
to any value. -
Non-superusers can only set the session
RUNTIMECAP
to a value equal to or lower than their own userRUNTIMECAP
.
Examples
Set the maximum query runtime for the current session to 10 minutes:
=> SET SESSION RUNTIMECAP '10 minutes';
Revert the session RUNTIMECAP
to your user default setting:
=> SET SESSION RUNTIMECAP =DEFAULT;
SET
=> SHOW RUNTIMECAP;
name | setting
------------+-----------
runtimecap | UNLIMITED
(1 row)
Set the RUNTIMECAP to 1 SECOND
and run an anonymous procedure with an infinite loop:
=> SET SESSION RUNTIMECAP '1 SECOND';
SET
=> DO $$
BEGIN
LOOP
END LOOP;
END;
$$;
ERROR 0: Query exceeded maximum runtime
HINT: Change the maximum runtime using SET SESSION RUNTIMECAP