It's the query options file.
Dan W.
Each system is shipped with a QAQQINI template file in library QSYS. The
QAQQINI file in QSYS is to be used as a template when creating all user
specified QAQQINI files. To create your own QAQQINI file, use the CRTDUPOBJ
command to create a copy of the QAQQINI file in the library that will be
specified on the CHGQRYA QRYOPTLIB parameter. The file name must remain QAQQINI,
for example:
CRTDUPOBJ OBJ(QAQQINI)
FROMLIB(QSYS)
OBJTYPE(*FILE)
TOLIB(MYLIB)
DATA(*YES)
Because system-supplied triggers are attached to the QAQQINI file in QSYS it
is imperative that the only means of copying the QAQQINI file is through the
CRTDUPOBJ CL command.
Note: |
It is recommended that the file QAQQINI, in
QSYS, not be modified. This is the original template that is to be
duplicated into QUSRSYS or a user specified library for use.
|
Query Options File:
UNIQUE
R QAQQINI TEXT('Query options + file')
QQPARM 256A VARLEN(10) +
TEXT('Query +
option parameter') +
COLHDG('Parameter')
QQVAL 256A VARLEN(10) +
TEXT('Query option +
parameter value') +
COLHDG('Parameter Value')
QQTEXT 1000G VARLEN(100) +
TEXT('Query +
option text') +
ALWNULL +
COLHDG('Query Option' +
'Text') +
CCSID(13488) +
DFT(*NULL)
K QQPARM
The QAQQINI file shipped in the library QSYS has been pre-populated with the
following rows:
Table 8. QAQQINI File Records
Description |
QQPARM |
QQVAL |
APPLY_REMOTE |
*DEFAULT |
ASYNC_JOB_USAGE |
*DEFAULT |
FORCE_JOIN_ORDER |
*DEFAULT |
MESSAGES_DEBUG |
*DEFAULT |
OPTIMIZE_STATISTIC_LIMITATION |
*DEFAULT |
PARALLEL_DEGREE |
*DEFAULT |
PARAMETER_MARKER_CONVERSION |
*DEFAULT |
QUERY_TIME_LIMIT |
*DEFAULT |
UDF_TIME_OUT |
*DEFAULT |
The QAQQINI file query options can be modified with the INSERT, UPDATE, or
DELETE SQL statements.
For the following examples, a QAQQINI file has already been created in
library MyLib. To update an existing row in MyLib/QAQQINI use the UPDATE SQL
statment. This example sets MESSAGES_DEBUG = *YES so that the query optimizer
will print out the optimizer debug messages:
UPDATE MyLib/QAQQINI SET QQVAL='*YES'
WHERE QQPARM='MESSAGES_DEBUG'
To delete an existing row in MyLib/QAQQINI use the DELETE SQL statement. This
example removes the QUERY_TIME_LIMIT row from the QAQQINI file:
DELETE FROM MyLib/QAQQINI
WHERE QQPARM='QUERY_TIME_LIMIT'
To insert a new row into MyLib/QAQQINI use the INSERT SQL statement. This
example adds the QUERY_TIME_LIMIT row with a value of *NOMAX to the QAQQINI
file:
INSERT INTO MyLib/QAQQINI
VALUES('QUERY_TIME_LIMIT','*NOMAX','New time limit set by DBAdmin')
The following table summarizes the query options that can be specified on the
QAQQINI command:
Table 9. Query Options Specified on QAQQINI
Command
Parameter |
Value |
Description |
APPLY_REMOTE |
*DEFAULT |
The default value is set to *NO.
|
*NO |
The CHGQRYA attributes for the job
are not applied to the remote jobs. The remote jobs will use the
attributes associated to them on their systems. |
*YES |
The query attributes for the job are
applied to the remote jobs used in processing database queries involving
distributed tables. For attributes where *SYSVAL is specified, the system
value on the remote system is used for the remote job. This option
requires that, if CHGQRYA was used for this job, the remote jobs must have
authority to use the CHGQRYA command. |
ASYNC_JOB_USAGE |
*DEFAULT |
The default value is set to *LOCAL.
|
*LOCAL |
Asynchronous jobs may be used for
database queries that involve only tables local to the system where the
database queries are being run. In addition, for queries involving
distributed tables, this option allows the communications required to be
asynchronous. This allows each system involved in the query of the
distributed tables to run its portion of the query at the same time (in
parallel) as the other systems. |
*DIST |
Asynchronous jobs may be used for
database queries that involve distributed tables. |
*ANY |
Asynchronous jobs may be used for
any database query. |
*NONE |
No asynchronous jobs are allowed to
be used for database query processing. In addition, all processing for
queries involving distributed tables occurs synchronously. Therefore, no
inter-system parallel processing will occur. |
FORCE_JOIN_ORDER |
*DEFAULT |
The default is set to *NO. |
*NO |
Allow the optimizer to re-order join
tables. |
*YES |
Do not allow the query optimizer to
re-order join tables as part of its optimization process. The join will
occur in the order in which the tables were specified in the query. |
MESSAGES_DEBUG |
*DEFAULT |
The default is set to *NO. |
*NO |
No debug messages are to be
displayed. |
*YES |
Issue all Query Optimizer debug
messages. |
OPTIMIZE_STATISTIC_ LIMITATION
|
*DEFAULT |
The amount of time spent in
gathering index statistics is determined by the query optimizer. |
*NO |
No index statistics will be gathered
by the query optimizer. Default statistics will be used for optimization.
(Use this option sparingly.) |
*PERCENTAGE integer value |
Specifies the maximum percentage of
the index that will be searched while gathering statistics. Valid values
for are 1 to 99. |
*MAX_NUMBER_ OF_RECORDS_ ALLOWED
integer value |
Specifies the largest table size, in
number of rows, for which gathering statistics is allowed. For tables with
more rows than the specified value, the optimizer will not gather
statistics and will use default values. |
PARALLEL_DEGREE |
*DEFAULT |
The default value is set to *SYSVAL.
|
*SYSVAL |
The processing option used is set to
the current value of the system value, QQRYDEGREE. |
*IO |
Any number of tasks can be used when
the database query optimizer chooses to use I/O parallel processing for
queries. SMP parallel processing is not allowed. |
*OPTIMIZE |
The query optimizer can choose to
use any number of tasks for either I/O or SMP parallel processing to
process the query or database table index build, rebuild, or maintenance.
SMP parallel processing is used only if the system feature, DB2 Symmetric
Multiprocessing for OS/400, is installed. Use of parallel processing and
the number of tasks used is determined with respect to the number of
processors available in the system, this job has a share of the amount of
active memory available in the pool in which the job is run, and whether
the expected elapsed time for the query or database table index build or
rebuild is limited by CPU processing or I/O resources. The query optimizer
chooses an implementation that minimizes elapsed time based on the job has
a share of the memory in the pool. |
*MAX |
The query optimizer chooses to use
either I/O or SMP parallel processing to process the query. SMP parallel
processing will only be used if the system feature, DB2 Symmetric
Multiprocessing for OS/400, is installed. The choices made by the query
optimizer are similar to those made for parameter value *OPTIMIZE except
the optimizer assumes that all active memory in the pool can be used to
process the query or database table index build, rebuild, or maintenance.
|
*NONE |
No parallel processing is allowed
for database query processing or database table index build, rebuild, or
maintenance. |
PARAMETER_MARKER_ CONVERSION
|
*DEFAULT |
The default value is set to *NO.
|
*NO |
Constants cannot be implemented as
parameter markers. |
*YES |
Constants can be implemented as
parameter markers. |
QUERY_TIME_LIMIT
|
*DEFAULT |
The default value is set to *SYSVAL.
|
*SYSVAL |
The query time limit for this job
will be obtained from the system value, QQRYTIMLMT. |
*NOMAX |
There is no maximum number of
estimated elapsed seconds. |
integer value |
Specifies the maximum value that is
checked against the estimated number of elapsed seconds required to run a
query. If the estimated elapsed seconds is greater than this value, the
query is not started. Valid values range from 0 through 2147352578. |
UDF_TIME_OUT
|
*DEFAULT |
The amount of time to wait is
determined by the database. The default is 30 seconds. |
*MAX |
The maximum amount of time that the
database will wait for the UDF to finish. |
integer value |
Specify the number of seconds that
the database should wait for a UDF to finish. If the value given exceeds
the database maximum wait time, the maximum wait time will be used by the
database. Minimum value is 1 and maximum value is system defined.
|
QAQQINI is shippped with a *PUBLIC *USE authority. This allows users to view
the query options file, but not change it. It is recommended that only the
system or database administrator have *CHANGE authority to the QAQQINI query
options file.
The query options file, which resides in the library specified on the CHGQRYA
CL command QRYOPTLIB parameter, is always used by the query optimizer. This is
true even if the user has no authority to the query options library and file.
This provides the system administrator with an additional security mechanism.
When the QAQQINI file resides in the library QUSRSYS the query options will
effect all of the query users on the system. To prevent anyone from inserting,
deleting, or updating the query options, the system administrator should remove
update authority from *PUBLIC to the file. This will prevent users from changing
the data in the file.
When the QAQQINI file resides in a user library, specified on the CHGQRYA CL
command option QRYOPTLIB, the query options will effect all of the querys run
for that user's job. To prevent the query options from being retrieved from a
particular library the system administrator can revoke authority to the CHGQRYA
CL command.
The query options file QAQQINI file uses a system-supplied trigger program in
order to process any changes made to the file. A trigger cannot be removed from
or added to the file QAQQINI.
If an error occurs on the update of the QAQQINI file (an INSERT, DELETE, or
UPDATE operation), the following SQL0443 diagnostic message will be issued:
Trigger program or external routine detected an error.