SAVE QUERY

Saves an input query to associate with a custom directed query.

Syntax

SAVE QUERY input-query

Parameters

input‑query The input query to associate with a custom directed query. The input query supports only one optimizer hint, IGNORECONST.

Privileges

Superuser

Description

SAVE QUERY saves the specified input query for use by the next invocation of CREATE DIRECTED QUERY CUSTOM. CREATE DIRECTED QUERY CUSTOM pairs the saved query with its annotated query argument to create a directed query. Both statements must be issued in the same user session.

The saved query remains available until the one of the following events occurs:

  • The next invocation of CREATE DIRECTED QUERY, whether invoked with CUSTOM or OPTIMIZER.
  • Another invocation of SAVE QUERY.
  • The session ends.

Vertica associates a saved query with a directed query without checking whether the input and annotated queries are compatible. Be careful to sequence SAVE QUERY and CREATE DIRECTED QUERY CUSTOM so the saved and directed queries are correctly matched.

Examples

See Custom Directed Queries.