SELECT_GRID_ALL session environment option

Use the SELECT_GRID_ALL option of the SET ENVIRONMENT statement to define a default GRID clause for subsequent grid queries in the session. This clause specifies a default grid or region from which to return a result set equivalent to a logical UNION ALL of qualifying rows from participating grid servers.

SELECT_GRID_ALL environment option

1  SET ENVIRONMENT SELECT_GRID_ALL 
2.1 'grid'
2.1 'region'
2.1 DEFAULT
Element Description Restrictions Syntax
grid Name of a default grid for queries with no GRID clause The grid must exist Identifier
region Name of a default region for queries with no GRID clause The region must exist Identifier

Usage

The SELECT_GRID_ALL session environment option can be set to any of three values:
'grid'
This specifies the default grid from which SELECT statements that include no GRID clause can return a result set that is the logical UNION ALL of qualifying rows, including duplicates, from all of the participating grid servers in the specified grid. While the SELECT_GRID option of the SET ENVIRONMENT statement is set to the name of a grid, the database server that issued the SET ENVIRONMENT SELECT_GRID_ALL 'grid' statement interprets all queries as UNION ALL grid queries.
'region'
This specifies the default region from which SELECT statements that include no GRID clause can return a result set that is the logical UNION ALL of qualifying values, including duplicates, from all of the participating grid servers in the specified region. While the SELECT_GRID option of the SET ENVIRONMENT statement is set to the name of a region, the database server that issued the SET ENVIRONMENT SELECT_GRID_ALL ’region’ statement interprets all queries as UNION ALL grid queries.
DEFAULT
This setting specifies the default behavior. While the SELECT_GRID_ALL option of the SET ENVIRONMENT statement is set to DEFAULT, the database server does not process every query that has no GRID clause as a grid query. Thus, the DEFAULT setting specifies that there is no default GRID clause for SELECT statements. Use this option to disable the effects of a previous SET ENVIRONMENT SELECT_GRID or SET ENVIRONMENT SELECT_GRID_ALL statement that defined a default GRID clause for all queries that include no GRID clause.

Unlike the SELECT_GRID option, the SELECT_GRID_ALL setting enables subsequent queries that include no GRID clause to behave as grid queries that return duplicate values.

The SELECT_GRID_ALL and the SELECT_GRID options of the SET ENVIRONMENT statement are mutually exclusive. After you issue the SET ENVIRONMENT SELECT_GRID_ALL or SET ENVIRONMENT SELECT_GRID statement, issuing a different option of either statement in the same session replaces whatever the previous ENVIRONMENT SELECT_GRID_ALL or SET ENVIRONMENT SELECT_GRID statement established as the server behavior for grid queries in the session.

Restrictions on SELECT_GRID_ALL

Do not call the ifx_gridquery_skipped_nodes() function while the SELECT_GRID_ALL session environment variable is set to 'grid' or to 'region'.

The SELECT_GRID_ALL session environment option should not be set to 'grid' or to 'region' outside a grid context.

Examples of setting SELECT_GRID_ALL

The following statement establishes a default grid called escorial for the current session, and instructs the database server to interpret all queries that include no GRID clause as UNION ALL grid queries for that grid:
SET ENVIRONMENT SELECT_GRID_ALL "escorial";
If california were the name of a region in the escorial grid, the next example would instruct the database server to interpret all queries that include no GRID clause as UNION ALL grid queries for the california region, rather than having the entire escorial grid as their scope:
SET ENVIRONMENT SELECT_GRID_ALL "california";
The following example overrides the effect of any previous SET ENVIRONMENT SELECT_GRID_ALL statement that established a default grid or a default region, and an implicit UNION ALL operator, as the scope of subsequent queries that include no GRID clause:
SET ENVIRONMENT SELECT_GRID_ALL DEFAULT;
The statement above restores the default behavior for processing queries in the session, so that the database interprets only SELECT statements that explicitly include the GRID clause as grid queries.

For more information about grid queries, see the GRID clause and the HCL OneDB™ Enterprise Replication Guide.