Product Documentation

Database Administrator's Guide

Previous Topic

Next Topic

MAX_K_TO_USE

MAX_K_TO_USE

MAX_K_TO_USE can improve the performance of a rebuild. The value is specified in kilobytes (KB) with no scaling factor (such as KB, MB, GB, etc.). A scaling factor is ignored if specified; therefore specifying "4 GB" is the same as "4" and is interpreted as 4 KB. (The SORT_MEMORY keyword supports scaling factors.)

The rebuild function does a scan on the data file. At the end of the scan the number of records (max key values) is known. An output buffer is used to write sorted key values to disk when needed, that is, when all keys can't fit into data buffers. Data buffers contain unsorted key values put there while the data file is scanned. When all data buffers or the pointer area are full, the logic sorts the pointers in the buffer by key value and then writes all data in data buffers to disk. Output is done in output buffer sized chunks to sort work files, which are c-tree data files.

Based on the actual number of keys (number of records) and key size + pntr size the fraction of key values that can stored in the given memory (MAX_K_TO_USE) is known. If the memory is large enough then just that amount of memory is needed. If the memory is not large enough then the number of file handles needed to store the values on disk is computed, limited by the MAX_HANDLES value.

If both SORT_MEMORY and MAX_K_TO_USE are specified in ctsrvr.cfg, only the one that is specified last in the configuration file takes effect.

Default: 10000 (10 MB)

See Also

SORT_MEMORY

MAX_HANDLES

TOCIndex