Updated on 2024-12-18 GMT+08:00

Dictionary Code Hint

Function

Specifies a column to create a dictionary code and compares the encoded strings as numbers, which speeds up the query operations such as Group By and Filter. This hint is supported only by clusters of version 8.3.0 or later.

Precautions

  • Currently, only the new version hstore tables are supported (the table-level parameter enable_hstore_opt is set to on).

Syntax

 /* + ( no ) dict(table (column)) */

Parameter description

  • dict(table (column))

    Column with the dictionary encoding table enabled.

  • no dict(table (column))

    Column with the dictionary encoding table disabled.

Example

1
SELECT /*+ dict (bitmaptbl_high (server_ip)) */ distinct(server_ip) FROM bitmaptbl_high WHERE scope_name='saetataetaeta' ORDER BY server_ip;

The generated plan is as follows. server_ip uses the dictionary encoding:

You can use no dict to disable server_ip from using dictionary encoding.

1
SELECT /*+ no dict (bitmaptbl_high (server_ip)) */ distinct(server_ip) FROM bitmaptbl_high WHERE scope_name='saetataetaeta' ORDER BY server_ip;