- Scoped Hints - affect a portion of the query
- Global Hints - affect the entire query
Scoped Hints
Scoped hints may appear anywhere in the query. Scoped hints must be in a comment block in the form:KI_HINT_DELTA_TABLE
KI_HINT_DELTA_TABLE
FROM <table> clause to
which it applies, but before any table alias specified for that table.KI_HINT_GROUP_BY_PK
KI_HINT_GROUP_BY_PK
GROUP BY, and can also make
materialized views containing
grouping operations more performant.SELECT
keyword or immediately after the FROM <table> clause.KI_HINT_MATERIALIZE
KI_HINT_MATERIALIZE
WITH clause; if different WHERE
clauses are applied to the CTE, the CTE query may only have to be evaluated
once.This hint must be placed immediately after the SELECT keyword, like the
SELECT producing a join.KI_HINT_MATERIALIZE includes the functionality of
KI_HINT_NO_VIRTUAL_UNION.KI_HINT_NO_VIRTUAL_UNION
KI_HINT_NO_VIRTUAL_UNION
SELECT keyword, like
the first SELECT keyword in the union.Global Hints
Global hints may appear anywhere in the query. Global hints must be in a comment block in the form:KI_HINT_BATCH_SIZE(n)
KI_HINT_BATCH_SIZE(n)
n records. Default: 10,000.Only applicable when issuing INSERT statements.KI_HINT_CHUNK_SIZE(n)
KI_HINT_CHUNK_SIZE(n)
n records per chunk within result sets.
Suffixes of K & M can be used to represent thousands or
millions of records; e.g., 20K, 50M.KI_HINT_COST_BASED_OPTIMIZATION
KI_HINT_COST_BASED_OPTIMIZATION
sql.cost_based_optimization), they can be turned on for an individual
query using this hint.KI_HINT_DICT_PROJECTION
KI_HINT_DICT_PROJECTION
KI_HINT_DISTRIBUTED_OPERATIONS
KI_HINT_DISTRIBUTED_OPERATIONS
KI_HINT_DONT_COMBINE
KI_HINT_DONT_COMBINE
KI_HINT_GROUP_BY_FORCE_REPLICATED
KI_HINT_GROUP_BY_FORCE_REPLICATED
KI_HINT_GROUP_BY_PK
KI_HINT_GROUP_BY_PK
GROUP BY, and can also make materialized views containing grouping
operations more performant.KI_HINT_HAS_HEADER
KI_HINT_HAS_HEADER
KI_HINT_IGNORE_EXISTING_PK
KI_HINT_IGNORE_EXISTING_PK
KI_HINT_UPDATE_ON_EXISTING_PK hint is used to switch to upsert mode
for inserts or overwrite mode for updates, then this hint is ignored.KI_HINT_INDEX(column_list)
KI_HINT_INDEX(column_list)
column_list; often used with
CREATE TABLE … AS to create an index on a
persisted result set.KI_HINT_JOIN_TABLE_CHUNK_SIZE(n)
KI_HINT_JOIN_TABLE_CHUNK_SIZE(n)
n records per chunk within joins.
Suffixes of K & M can be used to represent thousands or
millions of records; e.g., 20K, 50M.KI_HINT_KEEP_TEMP_TABLES
KI_HINT_KEEP_TEMP_TABLES
KI_HINT_KEY_LOOKUP
KI_HINT_KEY_LOOKUP
KI_HINT_MAX_CONCURRENCY(n)
KI_HINT_MAX_CONCURRENCY(n)
n concurrency, usually lower than the
system or user group limit in order to avoid resource exhaustion.KI_HINT_NO_COST_BASED_OPTIMIZATION
KI_HINT_NO_COST_BASED_OPTIMIZATION
KI_HINT_NO_DICT_PROJECTION
KI_HINT_NO_DICT_PROJECTION
KI_HINT_NO_DISTRIBUTED_OPERATIONS
KI_HINT_NO_DISTRIBUTED_OPERATIONS
KI_HINT_NO_HEADER
KI_HINT_NO_HEADER
KI_HINT_NO_JOIN_COUNT
KI_HINT_NO_JOIN_COUNT
KI_HINT_NO_LATE_MATERIALIZATION
KI_HINT_NO_LATE_MATERIALIZATION
KI_HINT_NO_NATIVE_SEMI_JOINS
KI_HINT_NO_NATIVE_SEMI_JOINS
KI_HINT_NO_PARALLEL_EXECUTION
KI_HINT_NO_PARALLEL_EXECUTION
KI_HINT_NO_PLAN_CACHE
KI_HINT_NO_PLAN_CACHE
KI_HINT_NO_QUERY_RESULT_CACHING
KI_HINT_NO_QUERY_RESULT_CACHING
KI_HINT_NO_RULE_BASED_OPTIMIZATION
KI_HINT_NO_RULE_BASED_OPTIMIZATION
KI_HINT_NO_SHADOW_CUBE
KI_HINT_NO_SHADOW_CUBE
KI_HINT_NO_SSQ_OPTIMIZATION
KI_HINT_NO_SSQ_OPTIMIZATION
KI_HINT_NO_VALIDATE_CHANGE
KI_HINT_NO_VALIDATE_CHANGE
KI_HINT_NO_VIRTUAL_UNION
KI_HINT_NO_VIRTUAL_UNION
KI_HINT_PROJECT_MATERIALIZED_VIEW
KI_HINT_PROJECT_MATERIALIZED_VIEW
KI_HINT_REPL_ASYNC
KI_HINT_REPL_ASYNC
KI_HINT_REPL_ASYNC_PARALLEL
KI_HINT_REPL_ASYNC_PARALLEL
KI_HINT_REPL_NONE
KI_HINT_REPL_NONE
KI_HINT_REPL_SYNC
KI_HINT_REPL_SYNC
KI_HINT_REPL_SYNC_PARALLEL
KI_HINT_REPL_SYNC_PARALLEL
KI_HINT_REQUEST_TIMEOUT(m)
KI_HINT_REQUEST_TIMEOUT(m)
m minutes when processing this command.KI_HINT_SAVE_UDF_STATS
KI_HINT_SAVE_UDF_STATS
KI_HINT_SCHEDULING_PRIORITY(n)
KI_HINT_SCHEDULING_PRIORITY(n)
n priority, usually lower than the
system or user group limit in order to avoid resource exhaustion.KI_HINT_SERVER_SIDE_INSERT
KI_HINT_SERVER_SIDE_INSERT
KI_HINT_TRUNCATE_STRINGS
KI_HINT_TRUNCATE_STRINGS
KI_HINT_UPDATE_ON_EXISTING_PK
KI_HINT_UPDATE_ON_EXISTING_PK
- For INSERT statements, invoke an upsert scheme; any existing table record with primary key values that match those of a record being inserted will be replaced by that new record.
- For UPDATE statements, invoke an overwrite scheme;
if a record update causes the record’s primary key to match that of
another record in the same table, that other record will be removed and
the original record will remain, updated with its new primary key and any
other values from the
SETclause.
INSERT or UPDATE will be rejected and the
error handled based on the presence of the KI_HINT_IGNORE_EXISTING_PK
hint. If the specified table does not have a primary key, then this hint
will be ignored.KI_HINT_WAL_SYNC_METHOD(method)
KI_HINT_WAL_SYNC_METHOD(method)
method for a query.| Method | Description |
|---|---|
none | Disables the write-ahead log feature. |
background | WAL entries are periodically written instead of immediately after each operation. |
flush | Protects entries in the event of a database crash. |
fsync | Protects entries in the event of an OS crash. |
Testing Hints
The following global hints are intended to be used for testing. They are usually not recommended for regular use and are subject to change.KI_HINT_NO_CHUNK_SKIPPING
KI_HINT_NO_CHUNK_SKIPPING
KI_HINT_NO_CONSTANT_FOLDING
KI_HINT_NO_CONSTANT_FOLDING
KI_HINT_NO_HAVING_PUSHDOWN
KI_HINT_NO_HAVING_PUSHDOWN
HAVING clauses when planning this query.KI_HINT_NO_TRANSITIVE_SIMPLIFICATIONS
KI_HINT_NO_TRANSITIVE_SIMPLIFICATIONS