Altering the size of your hash spaces

You can alter the size of your hash spaces when you are monitoring and tuning the performance of tables that are organized by hash. Hash-organized table spaces are deprecated and likely to be unsupported in the future.

About this task

Deprecated function:

FL 504 Hash-organized tables are deprecated. Beginning in Db2 12, packages that are bound with APPLCOMPAT(V12R1M504) or higher cannot create hash-organized tables or alter existing tables to use hash-organization. Existing hash-organized tables remain supported, but they are likely to be unsupported in the future.

When you tune the performance of tables that are organized by hash, you can alter the size of the hash space with the ALTER TABLE statement.

Procedure

To alter the size of the hash space for a table, use one of the following approaches:

  • Run the REORG TABLESPACE utility on the table space and specify AUTOESTSPACE YES in the REORG TABLESPACE statement.
    Db2 automatically estimates a size for the hash space based on information from the real-time statistics tables. If you specify AUTOESTSPACE NO in the REORG TABLESPACE statement, Db2 uses the hash space that you explicitly specified for the table space.
  • Specify ALTER ORGANIZATION in an ALTER TABLE statement.
    1. Specify SET HASH SPACE followed by an integer and a modifier specifying the size of the hash space.
      You can specify the size of the hash space in kilobytes, megabytes, and gigabytes. Specify:
      • K for kilobytes
      • M for megabytes
      • G for gigabytes
      Specify the size of your hash space based on the predicted size of the table. For more information about choosing an appropriate size for the hash space, see Managing space and page size for hash-organized tables (deprecated).
      For example, the following statement specifies a size of 64 megabytes for the hash space of the EMP table:
      ALTER TABLE EMP
      ALTER ORGANIZATION  SET HASH SPACE 64 M;
    2. Commit the ALTER TABLE statement.

What to do next

Monitor the real-time-statistics information about your table to ensure that the hash access path is used regularly and that your disk space is used efficiently.