Configuring Query Processing Modes
To optimize connector performance, you can modify how the connector runs queries and retrieves results into memory. For example, you can configure the connector to return entire query results into memory all at once, or one row at a time. Use a query processing mode that prevents queries from consuming too much memory, based on the expected result size of your queries and the specifications of your system.
Use Single Row Mode if you plan to query large results and you do not want to retrieve the entire result into memory. Using the other query processing modes increases performance, but can result in out-of-memory errors.
You can set the connection properties described below in a connection string or in a DSN (in the odbc.ini
file). Settings in the connection string take precedence over
settings in the DSN.
Enabling Single Row Mode
You can configure the connector to return query results one row at a time.
To enable Single Row Mode:
- Set the
SingleRowModeproperty to1. - Make sure that the
UseDeclareFetchproperty is set to0or not set.
Enabling Declare/Fetch Mode
You can configure the connector to return a specific number of rows at a time.
To enable Declare/Fetch Mode:
- Set the
UseDeclareFetchproperty to1. - Set the
Fetchproperty to the number of rows that the connector returns at a time.
Enabling Retrieve Entire Result Mode
You can configure the connector to return entire query results into memory.
To enable Retrieve Entire Result Mode:
- Make sure that the
SingleRowMode,UseDeclareFetch, andUseMultipleStatementsproperties are set to0or not set.
Enabling Multiple Statements Mode
The connector can have more than one query, separated by a semicolon ( ; ), in a single SQLExecDirect call. The connector returns all the query results into memory.
To enable Multiple Statements Mode:
- Set the
UseMultipleStatementsproperty to1. -
Make sure that the
SingleRowModeandUseDeclareFetchproperties are set to0or not set.
Enabling Enforce Single Statement Mode
You can configure the connector to return SQL_ERROR immediately for any other queries that is executed if there is already an active query in execution under the same connection.
To enable Enforce Single Statement Mode:
- Set the
EnforceSingleStatementproperty to1. - Make sure that the
UseMultipleStatementsis set to0or not set.