Send feedback on this topic.
Teradata.Client.Provider
Potential Conflicts
.NET Data Provider for Teradata > Developer's Guide > Performance Considerations And Best Practices > Potential Conflicts

As explained in the Overview topic, the Advanced SQL Engine allows only one request to be active on a session at one time. When a data retrieval operation must process a large amount of data this requires multiple interactions with the SQL Engine. The Data Provider will not 'lock' the session for use only by this one data retrieval method; it will fetch a single buffer of data and then release its hold on the session.

This allows multiple data readers to execute retrieval methods simultaneously. In reality only one data reader will be fetching data from the SQL Engine at one time, but the requests from multiple readers will be interweaved such that one may be processing the data it received while another fetches more data.

However this introduces a potential issue. If a new command is executed this will tie up the session until the SQL Engine has processed the request and sent back its first response. Unlike a data retrieval operation which generally takes only a few milliseconds, the execution of a query may take many minutes or even hours. The Data Provider is therefore designed so that a data retrieval operation will not wait for the session to become available if it is currently being used to execute a command. Instead it will throw an exception indicating that the session is busy.

This 'session busy' exception may occur after a retrieval operation had already read many buffers of data and with many more buffers still to be fetched. In some cases the operation can simply be repeated after the command execution has completed. In other cases this will not be possible. Refer to the Re-tryable Exceptions and Exceptions that are not Re-tryable topics for more information.

As a general rule it is strongly recommended that you do not execute a new command while any data retrieval method that may require multiple buffers of data is being executed. This may include such methods as Read() or NextResult(), and any method that fetches the data for a Large Object (LOB) column.

You should also be aware that when working with Deferred LOBs the following methods will execute a new command on your behalf and should therefore also be avoided while a data retrieval operation is in progress: