Reasons for SQL Statements

Previous Next

The table below lists reasons that can cause a SQL statement to be executed.

The values in the Reason column are those that are displayed when you use USoft BenchMark to interpret a Profile.

Reason

Description

AUTHORIZATION

Occurs when conditions on table and column rights are checked

Example: If a table right specifies that records should exist in another table, a SQL SELECT statement is generated and executed to determine whether these records actually exist.

BATCH_FETCH

Occurs when batch manipulations are fetched.

CARDINALITY

Occurs when relationship cardinality rules are checked.

Example: If the maximum number of child records is specified in a relationship definition, a SQL SELECT statement is generated and executed to determine the actual number of child records (just before committing a change or an insert).

CASCADING

Occurs when children are selected for evaluation and execution of referential integrity rules.

Example: If a referential integrity rule is specified as update cascade, the child records to be manipulated are first selected and then manipulated. Both SQL statements generate this reason.

COMPUTE_VIRTUAL

Occurs when a value is retrieved for a joined column or when a value is computed in an extra query.

Example: In a child record's virtual field a parent record field value is retrieved on the basis of the relationship between the tables involved. The execution of the value retrieving SQL SELECT statement causes this reason

CONSTRAINT_KEYQUERY

Occurs when primary keys are selected that might refer to constraints.

Example: If records of a child table are manipulated, the primary keys of the parent records are retrieved. This generates the reason.

Using these key values, restrictive and corrective single-record constraints can sometimes be executed only once per parent instead of for each child record.

CONSTRAINT_TEST

Occurs when a possible violation of a single-record constraint is checked.

Example: Suppose a subset of parent records (pointed out by the condition in the WHERE clause) can only be deleted if related child records do not exist, execution of the SQL SELECT statement checking for the existence of the child records generates this reason.

COUNT_QUERY

Occurs when the Count Query option is selected.

DOMAIN_CONSTRAINT

Occurs when the SQL statement of a Domain Constraint is evaluated.

Example: Although domain constraint definitions do not really look like SQL statements, internally they are transformed into full SQL statements. Execution of these domain SQL statements generates the reason.

FOREIGN_KEY

Occurs when a foreign key is checked.

Example: A SQL SELECT statement determining whether or not an existing (referenced) primary key value exists.

INVOKE_EXECUTION

Occurs when an INVOKE statement is executed.

The only exception is when the XML export method is invoked.

LOCK_RECORD

Occurs when a record is locked as preparation for manipulation.

Example: If a relationship cardinality check is scheduled by the Rules Engine the parent record is locked just before the actual SQL statement select is executed in order to avoid any manipulation of the parent.

If the record cannot be locked, or if the record does not exist, this results in an error.

MANIPULATION

Occurs when INSERT, DELETEs and UPDATEs are executed on the database.

NEWVALUES

Occurs when a new value is computed by a constraint.

Example: If the set clause of a corrective update constraint contains a subquery, the evaluation of the subquery (which determines the new value for the column to be updated) generates this reason.

OLD_NEWVALUES

Occurs when the retrieval and locking of updated records (SELECT_FOR_UPDATE) is combined with the determination of new values (NEWVALUES).

When records are updated, these records are locked first. If new values need to be determined, in some cases these new values can be queried within the same SQL statement. Execution of this SQL statement generates the reason.

This reason can only be generated if the COMBINE_QUERIES parameter has been set to True.

PERFORM_QUERY

Occurs when a query is performed.

Example: Execution of the SELECT statement retrieving the data for a lookup window generates this reason.

READ_RECORD

Occurs when a single record is read.

READ_ROWID

Occurs when a record ID is read.

Example: The record ID of newly inserted record is read immediately after the actual INSERT. This unique record identifier is used for optimization purposes.

RESTRICTED

Occurs when child records are selected because of evaluation restrictive referential rules.

Example: If a parent record is scheduled to be deleted the execution of the SQL SELECT statement checking the non-existence of child records generates this reason.

REVERSE_COMPUTE_VIRTUAL

Retrieves data by reversing the process of virtual column data computation in case of manipulation of joined or extra query columns (see COMPUTE_VIRTUAL).

Example: A joined column contains a parent column value retrieved on the basis of a relationship (foreign key, primary key). If you change this value, the Rules Engine generates the SQL SELECT statement trying to retrieve the primary key value of the parent record containing the (new) value. This leads to an update of the foreign key in the child record if the new primary key is indeed found.

The SQL SELECT statement trying to retrieve the primary key of the record containing the joined columns new value generates this reason.

ROW_CONSTRAINT

Occurs when single record constraints are evaluated.

Example: The execution of the SQL SELECT statement checking a logical relationship between fields in one record generates this reason.

SELECT_FOR_DELETE

Occurs when a record is selected for deleting.

Example: Evaluation of a corrective (delete) constraint causes the Rules Engine to generate a SQL statement to determine if there are records meeting the condition specified in the constraint WHERE clause (the ones meeting the condition are the ones to be updated).

Execution of this SQL SELECT statement generates the reason.

SELECT_FOR_INSERT

Occurs when a record is selected for inserting.

Example: Evaluation of a corrective (insert) constraint causes the Rules Engine to generate a SQL SELECT statement to determine whether the values to be inserted meet the condition specified in the WHERE clause of the constraint. This statement's execution generates the reason.

SELECT_FOR_UPDATE

Occurs when a record is selected for updating.

Example: The evaluation of a corrective (update) constraint causes the Rules Engine to generate a SQL statement to determine if there are records meeting the condition (the ones pointed out by selection are the ones to be updated!).

Execution of this SQL SELECT statement generates the reason.

SELECT_FOR_UPDATE_ON_SELF

Occurs when a record is selected for updating at record validation time, before the storage of the record.

Example: The evaluation of a corrective constraint that can be handled as an Update On Self constraint, causes the Rules Engine to generate a SQL statement to determine if the current record meets the condition.

Execution of this SQL SELECT statement generates the reason.

SELECT_FOR_XML

Occurs when the XML query method executes the SELECT part within an INVOKE statement.

SEQNO

Occurs when a unique sequence number is selected.

UNIQUE_KEY

Occurs when the uniqueness of a key is evaluated.

Example: Before an actual data manipulation action is executed on the database a SQL SELECT statement is generated to determine that the primary key value doesn't already exist in the target table. Execution of this SQL SELECT statement generates the reason.

XML_EXPORT_EXECUTION

Occurs when the XML export method generates XML output based on an INVOKE...SELECT statement.