General database

The MTA&#x27;s general database is available for site-specific uses. When a site could benefit from a database lookup from a rewrite rule, from a  mapping table, or from a Sieve filter (see the EXTLISTS extension), the general  database provides a simple, MTA-accessible  place to store such site-specific data. (Note that the MTA also supports LDAP, memcache, and MeterMaid, and Redis lookups,  which could all be considered forms of "database" lookup. But what is meant here is more specifically an on-disk or in-memory, basic, key-value "database".)

In early versions of the MTA, the format of the general database was an on-disk database, built using the   utility  based upon a flat text file input. As of MS 6.0, the option -- now preferred -- was introduced for storing the "database" directly in MTA process memory; use of such an "in memory database" is enabled via the   MTA option. When enabled, such an "in memory database" is constructed from a flat text input file at the time of a   command being issued, or at process startup time (if no compiled configuration is used). The allowed format of the flat text input file is very similar whether an old  database is constructed, or whether a   "in memory" database is constructed: key value one entry per line, with the   beginning in column one, one or more white space (SP or TAB) characters, and then the   on the right hand side.

When using a text, "in memory" general database (bit 0/value 1 of   is set), each left hand side (key) may have a maximum of 128 characters, while each right hand side (value) may have a maximum of 1024 characters. If a key or value contains any space or tab character, such character must be backslash quoted, e.g.: left\ hand\ side right-hand-side Any TAB character found will be converted to a space for storage in the in-memory general database.

The  MTA option controls which characters (by default exclamation point and semicolon) in column one of a line are considered to indicate a comment line. The left angle character may be used to read another file into the general database text input file.

Note: The MTA options   and    limit the overall size of the general database; these MTA options do not normally need to be manually adjusted.

For a  "on disk" database, the left hand side (the key) cannot contain spaces or tabs unless the   switch is used; the maximum length of the key and value depend upon whether the   switch is used.

See also:
 * use_text_databases MTA Option
 * general_data_size MTA Option
 * string_pool_size_3 MTA Option
 * Rewrite general database substitutions
 * comment_chars MTA Option
 * Mapping entry templates
 * Sieve external lists
 * crdb utility