SHOW STATEMENT HINTS

On this page Carat arrow pointing down

The SHOW STATEMENT HINTS statement lists the statement hints that have been created for a specific SQL statement fingerprint using the information_schema.crdb_rewrite_inline_hints() and information_schema.crdb_set_session_variable_hint() built-in functions.

Required privileges

Users must have the VIEWCLUSTERMETADATA privilege to run SHOW STATEMENT HINTS.

Synopsis

SHOW STATEMENT HINTS FOR string_or_placeholder WITH DETAILS , OPTIONS ( DETAILS , )

Parameters

Parameter Description
string_or_placeholder The SQL statement fingerprint to show hints for. This can be a string literal (such as 'SELECT * FROM users WHERE city = _') or a SQL parameter placeholder (such as $1) for use in prepared statements.

Options

Option Value Description
DETAILS N/A Include hint-specific information in JSON format.

Response

The following fields are returned:

Column Type Description
row_id INT A unique ID.
fingerprint STRING The SQL statement fingerprint that the hint applies to.
hint_type STRING Hint type. REWRITE INLINE HINTS indicates a rewritten inline hint. SET VARIABLE indicates a session variable override.
database STRING The database the hint applies to. NULL if the hint applies to all databases.
enabled BOOL Whether the hint is enabled.
created_at TIMESTAMPTZ The timestamp when the hint was created.
details JSONB When the DETAILS option is specified, hint-specific information in JSON format. For REWRITE INLINE HINTS, this includes the donor SQL fingerprint with hints that will be applied. For SET VARIABLE, this includes the session variable name and value.

Examples

Show hints for a statement

To show all hints for a specific statement fingerprint:

icon/buttons/copy
SHOW STATEMENT HINTS FOR $$ SELECT * FROM users WHERE city = _ $$;
        row_id        |            fingerprint             |      hint_type       | database | enabled |          created_at
----------------------+------------------------------------+----------------------+----------+---------+--------------------------------
  1143470380756697089 | SELECT * FROM users WHERE city = _ | REWRITE INLINE HINTS | NULL     | t       | 2026-01-21 21:11:06.782818+00
(1 row)

Show hints with detailed information

To include hint-specific details in the output:

icon/buttons/copy
SHOW STATEMENT HINTS FOR $$ SELECT * FROM users WHERE city = _ $$ WITH DETAILS;
        row_id        |            fingerprint             |      hint_type       | database | enabled |          created_at           |                              details
----------------------+------------------------------------+----------------------+----------+---------+-------------------------------+--------------------------------------------------------------------
  1143470380756697089 | SELECT * FROM users WHERE city = _ | REWRITE INLINE HINTS | NULL     | t       | 2026-01-21 21:11:06.782818+00 | {"donorSql": "SELECT * FROM users@users_city_idx WHERE city = _"}
(1 row)

This example shows a REWRITE INLINE HINTS type hint. For a SET VARIABLE hint, the details would include the session variable name and value:

        row_id        |            fingerprint             | hint_type    | database | enabled |          created_at           |                       details
----------------------+------------------------------------+--------------+----------+---------+-------------------------------+------------------------------------------------------
  1167741942826958849 | SELECT * FROM users WHERE city = _ | SET VARIABLE | NULL     | t       | 2026-04-17 14:42:39.7001+00   | {"variableName": "vectorize", "variableValue": "on"}
(1 row)

See also

×