Pervasive logo

Prev Advanced Operations Guide Next

Indexes


An index is a structure that sorts all the key values for a specific key. Btrieve access permits overlapping indexes (an index that includes a partial column). Relational access through ODBC does not permit overlapping indexes. (You can create an overlapping index with the File Information Editor, which you can display by clicking the Goto Editor button.)

Index Tasks

You perform the following tasks pertaining to indexes:

Creating Indexes

You cannot create an index for a file unless the file has at least one key defined. You can create a key with the File Information Editor .

To create an index

  1. Click Index4Create from the main menu, which opens the Create Index dialog box (Figure 14-10).

     
    Figure 14-10 Create Index Dialog Box

  1. Complete the following data boxes in the Create Index dialog box.

Index Type
Specify whether to create an internal or external index. Internal indexes are dynamically maintained as part of the data file. External indexes are separate files you generate as needed.

An external index file is a standard data file that contains records sorted by the key you specify. Each record consists of the following:
  • A 4-byte address identifying the physical position of the record in the original data file
  • A key value
Data File
Specify the name of the data file for which you want to create the index.
External Index File
Specify the name of the file to generate for an external index. Not applicable for internal indexes.
Key Specification Number in Information Editor to Use
Lists the key numbers defined in the File Information Editor. If the file contains a system-defined log key (also called system data) but the key has been dropped, this list includes SYSKEY, which you can select to re-add the system-defined log key to the file.
Existing Key Numbers in Data File
Click Refresh Lists to display the key number defined for the file. If the file contains a system-defined log key, this list includes SYSKEY.
Key Number to Use For Create
Click Refresh Lists to display the key numbers available (that is, not defined for the file). Highlight the key number you want to use when creating the index.

  1. You can click Go To Editor to display the File Information Editor dialog box, which shows more complete information about the key. You can click Refresh Lists to read key information from the data file and refresh the Existing Key Numbers in Data File and Key Number to Use For Create lists. You must click Refresh Lists before you can create an index.
  2. When you have completed the Create Index dialog box, click Execute to create the index. The amount of time required to create the index depends on how much data the file contains.

Dropping Indexes

Ensure that you understand the access performed by an application program before dropping an index. Certain functions fail (such as GET NEXT) if a required index is missing. This can result in an application program not functioning correctly.

To drop an index

  1. Click Index4Drop from the main menu The Drop Index dialog box appears (Figure 14-11).

     
    Figure 14-11 Drop Index Dialog Box

  1. Complete the following data boxes in the Drop Index dialog box.

MicroKernel File
Specify the name of the data file from which you want to drop the index.
Existing Key Numbers
Click Refresh List to display the key number defined for the file. Highlight the number of the key whose index you want to drop. If the file contains a system-defined log key, this list includes SYSKEY, which you can select to drop the system-defined log key from the file.
Renumber Keys
Renumbers the keys consecutively. Click this button to remove gaps that result from deleting an index.

  1. Click Refresh List to get the key information from the file you have specified.

Prev
Statistics Report
Contents
Up
Check for Revisions
Next
Data