Maintaining Ad Hoc Indexes

Ad hoc indexes, which enable you to create indexes suitable for optimizing ad hoc queries without requiring database reorganization, are defined as a subclass of DynaDictionary, with instances mapped to a RootSchema map file called _sindexes.dat.

The _sindexes.dat database file is partitioned (for example, _sindexes_part0000000001.dat), with each ad hoc index instance created in a new partition to facilitate a fast drop index operation, which uses the existing dropPartition operation. The classes that represent index meta data are mapped to the _sindexdefs.dat RootSchema database file. (The _sindexes.dat and _sindexdefs.dat files are of Kind_User_Data.)

The [JadeAdHocIndex] section in the JADE initialization file enables you to specify options for the worker applications that build, drop, and delete an ad hoc index, and for the controller application that starts worker applications when there is an ad hoc index maintenance operation to be performed. For details about the BuildCommitPeriod and MaxBuildWorkers parameters, see "JADE Ad Hoc Index Section [JadeAdHocIndex]", in the JADE Initialization File Reference.

An Index Writer application reads from the main database (or from journals when catch‑up is required), and creates and maintains the user‑defined index. The ODBC driver function that performs ODBC queries can then use a combination of ad hoc indexes and collections in the main database to satisfy queries.

The Ad Hoc Index Browser enables you to:

For details about using the jadclient executable to create indexes suitable for optimizing ad hoc queries without requiring database reorganization, see "Ad Hoc Index Batch Interface", in Chapter 1 of the JADE Runtime Application Guide.

Following the hostile takeover of a secondary database, any populated ad hoc indexes may be left in an inconsistent state with the remainder of the database, as some journals may not have been sent from the primary database and processed before the takeover operation. As existing ad hoc indexes are therefore marked as in error, drop the indexes and then build them, to clear the error state and make them consistent with the state of the rest of the database. To do this, from the Ad Hoc Index menu in the Ad Hoc Index Browser on the primary database:

  1. Select the Run Ad Hoc Index Controller App command.

  2. Select the index definition that has a red background in the Status column, indicating that it is in error.

  3. Select the Drop Index command.

    A confirmation message box is then displayed stating the number of instances of that index and prompting you to confirm that you do want to drop (unpopulate) it. Click the Yes button to confirm that the selected ad hoc index definition is to be dropped.

  4. In the Ad Hoc Index Browser table, select the dropped unpopulated index definition that you want to build.

  5. Select the Build Index command.