IFX_BATCHEDREAD_TABLE session environment option
Use the IFX_BATCHEDREAD_TABLE environment option of the SET ENVIRONMENT statement to enable or disable light scans on compressed tables, tables with rows that are larger than a page, and tables with VARCHAR, LVARCHAR, and NVARCHAR data during the current session.
A light scan bypasses the buffer pool by utilizing session memory to read directly from disk. Query execution plans that uses light scans on large tables can improve performance, compared to plans using full-table scans.
Usage
When the BATCHEDREAD_TABLE configuration parameter is not enabled, enabling the IFX_BATCHEDREAD_TABLE session environment variable can improve the performance of some DML operations on indexed tables.
To set this session environment variable, specify one of the following digits as a quoted string:
'1'
or"1"
- Enable light scans during the session for query execution on compressed tables, on tables with rows larger than a page, and on tables with VARCHAR, LVARCHAR, and NVARCHAR columns
'0'
or"0"
- Prevent the query optimizer from using these light scans for the session.
SET ENVIRONMENT IFX_BATCHEDREAD_TABLE '1';
The
following statement restores the default restriction on light scans
of tables with those attributes:SET ENVIRONMENT IFX_BATCHEDREAD_TABLE "0";
Light scans
- The optimizer must choose a sequential scan or a skip-scan of the table.
- The table must store at least a megabyte (MiB) of data.
- One of the following locking conditions must be satisfied:
- The isolation level is not Cursor Stability, and you hold at least a shared lock on the entire table.
- The isolation level is Dirty Read, or the database transaction logging mode is WITH NO LOG.
- compressed tables,
- tables with rows that are larger than a page,
- tables of variable row length.
Although these three table restrictions are in effect by default, they do not prevent light scans on qualifying large tables in databases where the BATCHEDREAD_TABLE configuration parameter is enabled, or in sessions where the BATCHEDREAD_TABLE session environment option is enabled.
"
) could be substituted
as the delimiters, but as in any SET ENVIRONMENT operation, an undelimited
digit for the setting returns an error:SET ENVIRONMENT IFX_BATCHEDREAD_TABLE 0; --Fails to disable light scans
--on qualifying large tables
In sessions where the IFX_BATCHEDREAD_TABLE configuration parameter and the IFX_BATCHEDREAD_TABLE session environment variable have different settings, the setting of the session environment variable takes precedence over the configuration parameter setting for the duration of the session, or until the IFX_BATCHEDREAD_TABLE session environment variable is reset.
- tables with data stored in blobspaces,
- tables with data stored in smart blobspaces,
- tables of variable row length.