Index

From AADoc

Jump to: navigation, search

The Index element in the XML Module Definition defines a table index in the database. Indexes aren't required, but may help improve database performance (sometimes dramatically so) in certain situations. They do impose some overhead when data is being saved, and also use some disk space

Because the performance gains of a specific index may vary between database platforms, it may make sense to eventually support separate XML index definition files, outside of the Module Definition XML files.

XML Syntax

(Note: optional attributes omitted):

If specified, the Index element should be defined in the ModuleFields element (see XML Module Definition).

At least one FieldRef to a TableField in the same module is required. The order in which they are specified will determine the order of the fields in the table index in the database.

<Index>
    <FieldRef name="Field1"/>
    (more than one FieldRef may be specified)
</Index>

Attributes

The Index element takes two optional attributes.

name
(Optional) A name for the index. If no name is specified, the generator will create a name based on the fields included in the index.
unique
(Optional) When given the value "yes", the index will be created as a UNIQUE constraint. That is, the database system (where supported) will enforce that no two rows in the table contain the same combination of values in the fields of the index. (Note: this was recently implemented and is not supported in version 0.8.2.)
Personal tools