Template Parameter Reference

Template parameters are property sheets for database components such as tables and indexes. The following are the categories of template parameters.

Template parameters are used to control attributes and behavior of database objects like tables, views, indexes, and queries. These template parameters make it possible to more easily control and change the attributes of a database object at specific stages of an object lifecycle. The purpose of template parameters is to let users have a broader and more flexible range of configurable attributes than typically available.

For example, users can set a template parameter to change the value of the transaction timeout for all their transactions in the current session. This provides a little easier configuration versus setting the timeout value for each transaction, while reducing complexity such as having session attributes for all such needs.

Template parameters allow users to have multiple flavors of the same object type in the database. The attributes of these objects are determined by the template parameters that apply to the specific object. The template parameters, and hence attributes of an object, can be controlled in a few different ways:

  • Set default template parameters
  • Set a session level template parameter value prior to creating or using an object
  • Set up named template files for these objects, based on the instance name of teh object.

These are described more fully in the following sections.

Template Files and Default Parameters

There is a set of template directories provided for some types of objects, i.e. tables, views, indexes, users, schemas, queries, and the database iteself. These directories are under the db/templates directory in the configuration directory.

Within each template sub-directory, e.g. table, there is a default.tpl file from which the default parameters for the object are loaded. If there is a specific default template specified for tables in the session or database,

Session Level and Database-wide Template Parameters

Some template parameters on database objects apply to all users of the database, and hence the parameter set for a session will not take effect. Other parameters can be set for the current user or session, and will apply to the objects created or used in the current session.

To set a template parameter from SQL, use the following syntax

SET TEMPLATE_PARAMETER 'template_type' 'template_parameter' parameter_value
Be sure to enclose the type and parameter in string literal quotes, and the value should be specified as a string or numberic literal. For example, this can be used to set transaction timeouts in seconds (transaction.timeout in user template), before starting a transaction that takes a long time. Use
SET TEMPLATE_PARAMETER 'user' 'transaction.timeout' 10000

Please see the User API Guide for information on setting template parameters in SQL.

Controlling Specific Instances

These template files are stored in directories for each type of object. When creating an object of a certain type, a named template can first be loaded to determine the properties of the object being created. The same template may also be used before an existing object is loaded from disk. The specific parameter determines in which cases the template parameter will apply. *Not all parameters can be set with templates, and not all pramaters can be set for each session.*

Index Cache Example

In order to control the cache for a specific index instance, create a template file in the conf/db/templates/index directory with the completely qualified name of your index, e.g. mydb.mycatalog.myschema.mytable.myindex.tpl or testdb.home.alex.products.products_PRIMARY_KEY.tpl. In the template file, add the parameter entry you want, e.g.

index.btree_max_cache=1000

Template parameters are provided for some of the important object types. These template parameters if set of a database instance, in most cases override the vales set in DbPrefs. In the documentation below, we will use the syntax used in the template files for the examples.