Before you create indexes on dBASE (.DBF) tables, you need to be familiar with a few general concepts.

Multiple index (.MDX) files. When you create an index, it is stored in a file with the file-name extension .MDX. Each index has a name (sometimes called a tag) that defines the index uniquely in the .MDX file.

A table’s main .MDX file is called the production index file. The production index file opens automatically when you open a table, so its indexes are automatically available—though no index sets the row order until you select it as the master index. As you update rows in a table, the affected indexes in the production index file are also updated. If you use any non-production .MDX files, they must be opened explicitly by entering statements in the Command window.

The production index file has the same name as the table plus the .MDX extension.

Key expressions. A key expression is a field name, or a combination of field names, functions, or operators, that determines how an index orders rows in a table. It must be a character, numeric, date, or float field, or an expression that evaluates to one of these types. The key expression can be up to 220 characters in length.

Primary key. The dBASE 7 table format supports primary keys, enabling you to create primary distinct indexes. Any field can be a primary key and you need not create the primary key before creating a secondary maintained index.

Simple indexes. A simple index uses a single field name for the key expression.

Complex indexes. A complex (or composite) index uses a combination of one or more fields, or a dBASE expression.

Ascending and descending order. Rows can be ordered in ascending order, lowest to highest (the default), or descending order, highest to lowest. For character fields, the order is ASCII or the order established by the language driver installed by the BDE.

Note

Keeping a large number of indexes affects performance, because dBASE Plus must update each one as the table is revised. If you need to improve performance, consider removing rarely-used indexes from the production index file.