chkind - Index Maintenance Daemon

SYNOPSIS

chkind database


DESCRIPTION
The daemon, chkind, watches a particular database, and makes sure that the Metamorph indices are maintained in an optimal state. As records are updated or added to the table the index marks these records as requiring a linear scan. This is because the time to search a small amount of text is insignificant when compared to the time required to update the index. Once the amount of changed text reaches a certain size it becomes beneficial to update the index.

The time taken to update the index is significantly greater than the time to insert a single record, so setting the parameters correctly is likely to take some tuning. The number of records to be searched also has an impact on search time. Rough guidelines are that for moderately large fields it is acceptable to set the threshold to several megabytes. Smaller fields may require smaller thresholds. The waiting period should be set to somewhere between a third and a half of the time you expect it to take to reach the threshold. This allows for normal variation in record sizes and entry rates.

Chkind monitors the indices in a database. For each index there are two parameters which determine when it will be re-indexed.

Threshold
The amount of data that must have changed to consider it worth re-indexing. The default amount of data if 5 megabytes.
Delay
The amount of time to wait between each check of the index. As it requires resources to check the amount of data that has changed this time should be chosen to match the application. The default time is one day, which is sufficient for those cases with less than an average of about 3 megabytes a day.

These parameters can be changed in the table SYSMETAINDEX. This table has the following fields
NAME
CHAR(20). Name of the index we are referring to.
WAIT
INTEGER. The number of seconds to wait between checks.
THRESH
INTEGER. How many bytes of changed data needed to require an index update.

An example of changing the parameters to look at the index every hour, and update if more than 200k has changed, assuming the index is called ix_1.

tsql "insert into SYSMETAINDEX values('ix_1', 3600, 200000);"

Chkind must be run on the server machine (the same machine that the database resides on). It must be run as a user with sufficient permissions to modify the indices it is monitoring, and select from the from the table.

Chkind does not automatically run in the background.

In the event that the system or chkind should crash, you may need to clean up some of the files that chkind was using. The files to remove are files with a temporary filename, typically of the form TNNNNN* and indexName_[XZ]*. indexName is the name of the index. NNNNN is the process ID of the process that was optimizing (updating) the index: if no such PID NNNNN exists, it is safe to remove these files, as the process crashed. Otherwise, these files are in use; leave them alone. This information is also in other index files, so they are safe to delete (when the process has died). The rest of the characters have the usual Unix shell wildcard meaning. Once these files have been removed it should be possible to restart chkind and the index will be updated as normal. Note that it is likely that rmlocks will also need to be run if there was a system crash.


EXAMPLE

run chkind in the foreground
chkind /usr/local/morph3/texis/testdb

run chkind in the background
chkind /usr/local/morph3/texis/testdb &


Copyright © Thunderstone Software     Last updated: Oct 5 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.