Activating and Deactivating Directed Queries
The optimizer uses only directed queries that are active. If multiple directed queries share the same input query, the optimizer uses the first one to be created.
You activate and deactivate directed queries with
ACTIVATE DIRECTED QUERY and
DEACTIVATE DIRECTED QUERY, respectively. For example, the following
ACTIVATE DIRECTED QUERY statement deactivates
findBostonCashiers_OPT and activates
=> DEACTIVATE DIRECTED QUERY findBostonCashiers_OPT; DEACTIVATE DIRECTED QUERY; => ACTIVATE DIRECTED QUERY findBostonCashiers_CUSTOM; ACTIVATE DIRECTED QUERY;
Vertica uses the active directed query for a given query across all sessions until it is explicitly deactivated by
DEACTIVATE DIRECTED QUERY or removed from storage by
DROP DIRECTED QUERY. If a directed query is active at the time of database shutdown, Vertica automatically reactivates it when you restart the database.
After a direct query is deactivated, the query optimizer handles subsequent invocations of the input query by using another directed query, if one is available. Otherwise, it generates its own query plan.