Query Processing Modes

To support performance tuning, the Simba Amazon Redshift ODBC Connector provides different query processing modes that you can configure to modify how the connector runs queries and retrieves results into memory.

The following query processing modes are available:

  • Single Row Mode: The connector returns query results one row at a time.
  • Declare/Fetch Mode: The connector returns a user-specified number of rows at a time.
  • Retrieve Entire Result Mode: The connector returns the entire query result into memory.
  • Multiple Statements Mode: The connector can have more than one query, separated by a semicolon ( ; ), in a single SQLExecDirect call. The application calls SQLMoreResults to move to the next result set. When using this mode, the connector returns all the query results into memory.
  • Enforce Single Statement Mode: The connector allows applications to allocate more than one statement handle and execute queries in each statement handle concurrently per connection. However, the connector allows only one active statement at a time for each connection. When using this mode, the connector returns SQL_ERROR immediately for any other queries that is executed if there is already an active query in execution under the same connection. You can use this mode in conjunction with the Single Row, Declare/Fetch, and Retrieve Entire Result modes. For more information, see Enforce Single Statement.

By default, the connector does not allow more than one active query at a time, and returns the entire query result into memory. When there is an active query in execution, the connector blocks queries in other statement handles from execution until the active query finishes execution and retrieves all the data, or when the application calls SQLCloseCursor or SQLFreeHandle with a HandleType of SQL_Handle_STMT to indicate that the statement handle can be freed.

Use a query processing mode that prevents queries from consuming too much memory, considering the expected result size of your queries and the specifications of your system.

For information about configuring how the connector processes queries, see Configuring Additional Optionssee Configuring Query Processing Modes.