Primary Key Definition Property

Official Content
This documentation is valid for:

To control the way in which GeneXus declares table primary keys in the DBMS.

Values

Primary Key: the PRIMARY KEY clause belonging to the CREATE TABLE sentence will be used to declare the primary key for each application's table. In this case, the primary key is created by the DBMS and its name does not match the Knowledge Base name. The index name depends on the DBMS (Oracle and DB2 use for example, a name like SYSxxxxxx where xxxxxx is a sequence of characters that make the index unique).

Index: the property Primary key index clustering appears (except when generating for DB2 Universal Database, DB2 for iSeries, MySQL, Oracle and PostgreSQL) and the configurable values of this property are:

  • Clustered: (default value). In this case, the index is created with the following syntax:  “CREATE UNIQUE CLUSTERED INDEX …”.
  • Not clustered: In this case, the index is created with the following syntax:  “CREATE UNIQUE NONCLUSTERED INDEX …”.

Constraint: belonging to the CREATE TABLE sentence will be used to declare the primary key for each application's table. In this case, the primary key is created by the DBMS and its name matched with the Knowledge Base name.

Default Value: Primary Key in all DBMSs that support it. If Primary Key is not supported Index is used.

How to apply changes

Create database | Rebuild all objects

Notes:

  • In general, we have not detected any performance difference in any of the types of primary keys defined. In all cases, an index will be created so that the supported DBMSs use them optimally. This configuration option is available, so that the designer makes his/her own choice.
  • A change in this configuration option will not force the entire reorganization of the database. The change becomes effective in the creation/reorganization processes that are carried out later on, and they are only performed over the indices that these processes can handle. In other words, a change in this configuration option will gradually be noted by the database as these tables are created.

Scope

Languages: .NET, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)
DBMS: DB2 for iSeries, DB2 Universal Database, Informix, MySQL, Oracle, PostgreSQL and SQL Server

See Also

Primary key Index Clustering Model Property