There are two session modes available: Teradata and ANSI. Each have a different transaction
protocol behavior and differently handle case sensitivity defaults, collating sequences, data
conversions, and display functions. The same SQL statement in one mode could perform
differently in another mode. For example, when there is an error:
• In ANSI mode, the system rolls back only the request that caused an error and not the
entire transaction. The locks already obtained are not released until COMMIT/ABORT/
ROLLBACK occurs.
• In Teradata Session mode, the system rolls back the entire transaction and all locks are
released.
MSR statements behave as though they are in Teradata session. Even though you run the MSR statements in BTEQ, the statements behave as if there are in BT and ET session. If one of the statements in MSR fails, all transactions would roll back.
on setting the Session Mode. The reasons for this are explained in the following sections.
What is Auto-Commit
Open Access products have a requirement that all statements sent to Teradata must be Auto-Committed. Therefore, every statement that is sent to Teradata must be followed by a "COMMIT WORK". Depending upon the setting of the Session Mode, the provider will have to send the "COMMIT WORK" statement, or the Teradata database will implicitly commit each statement that is processed.Teradata Session Mode
Commands that are executed when the Session Mode is set to Teradata mode are automatically (implicitly) committed by the Teradata database. The provider does not append a "COMMIT WORK" to the statement.Advantages
One advantage to this is that the provider does not have to append a "COMMIT WORK to each statement that is sent to Teradata. Another advantage is that the Teradata database will use the Fast Path processing and will directly send the data from the spool to the provider when retrieving the data of a deferred LOB. In contrast, when the Session Mode is set to ANSI, an extra copy of the LOB is made.For these reasons, specifying Teradata mode will provide the best performance.
ANSI Session Mode
To implement the Auto-Commit feature when the session mode is set to ANSI requires a "COMMIT WORK" to be sent after every statement that is executed. Some open access products implement this by first sending the statement to Teradata, and then sending a "COMMIT WORK".However, the .NET Provider for Teradata optimizes the handling of Auto-Commit by appending a "COMMIT WORK" to the statement that will be submitted to Teradata when it is possible --some statements cannot be submitted to Teradata as a multi-statement request. This significantly reduces the number of round-trips made from the provider to the Teradata database.
Performance Impact on LOB retrieval
Unfortunately, the Teradata database does the following when a "COMMIT WORK" is appended to the statement used to retrieve the data of a deferred LOB (TdClob or TdBlob):Both of these items have a negative effect on the performance of the provider during the retrieval of the LOB's data.
- Makes an extra copy of the LOB.
- Does not use the Fast Path processing.
Unconstrained DELETE
Although there is a negative performance impact on LOB processing in ANSI mode, applications will be able to easily take advantage of the Fast Path processing when executing Unconstrained DELETE statements. An Unconstrained DELETE statement contains no constraints in the where clause --all the rows in the table will be deleted.One of the following conditions must be met in order for Teradata to use the Fast Path processing on an Unconstrained Delete:
- It is the only DML (Data Manipulation Language) statement in the request followed by a "COMMIT WORK".
- It is the last statement in a multi-statement request followed by a "COMMIT WORK"