SAP ABAP Data Element QQKP (iSeries: Key Positioning (Database Monitor))
Hierarchy
SAP_BASIS (Software Component) SAP Basis Component
   BC-DB-DB4 (Application Component) DB2 for AS/400
     STU4 (Package) CCMS / AS/400
Basic Data
Data Element QQKP
Short Description iSeries: Key Positioning (Database Monitor)  
Data Type
Category of Dictionary Type D   Domain
Type of Object Referenced     No Information
Domain / Name of Reference Type QQYN    
Data Type CHAR   Character String 
Length 1    
Decimal Places 0    
Output Length 1    
Value Table      
Further Characteristics
Search Help: Name    
Search Help: Parameters    
Parameter ID   
Default Component name    
Change document    
No Input History    
Basic direction is set to LTR    
No BIDI Filtering    
Field Label
  Length  Field Label  
Short 11 Key Pos. 
Medium 21 Key Positioning 
Long 41 Key Positioning 
Heading 55 Key Positioning 
Documentation

Definition

QQKP indicates whether the key positioning access method was used to implement the query.
Y = Key positioning access method was used
N = Key positioning access method was not used

For the file-based monitor (STRDBMON/ENDDBMON), QQKP is available only for records with QQRID 3001 and 3002. QQILNM/QQIFNM is the index used and QQI3 contains the number of key fields used for key positioning.

For the memory-resident database monitor, QQKP is only available in the detail information tables SQ3001_DB4 and SQ3002_DB4, QQKPN contains the number of key fields of the index QQILNM/QIFNM used for key positioning.

Note

The Key Positioning Access Method.
Selection is performed against the index to position directly to a range of keys that match some or all of the selection criteria. All keys in this range are read and key selection is performed for any remaining selection where index key fields are used.
The following are used for key positioning: All index key fields starting with the leftmost key fields that are used in the selection criteria until the first index key field is encountered that is not used in the selection criteria. (The sequence of the fields in the selection criteria is irrelevant.)
The advantage of this method over key selection method (see: QQKS) is that only a subset of the keys of the index is processed.

Example

select * from FILE
where f1 = 'a' and f2 ='b' and f4='c'
order by f1

where FILE is a table with the fields F1, F2, F3, F4, F5 - all of type CHAR(5) - and an unique index FILE_1 over the fields F1, F2, F3, F4 exists.
This query will be implemented using the existing index FILE_1.
Key positioning is performed on the two leftmost key fields of the index (QQI3 = 2 for QQRID = 3001). Since the selection criteria leaves out the third index key field (F3), only these two fields can be used for key positioning.
Key selection is used for the remaining selection criteria because F4 is a key field of the index used in the implementation of this query. This means that all index entries of the index range selected by key positioning are now read. A record is retrieved if the specified key fields (in this example: F4) match the remaining selection criteria (in this example: F4 = 'C').

The query
select * from FILE
where f1 = 'a' and f2 ='b' and f4='c'
and f3 >= ''
order by f1
would return the same records as the query above, but all index key fields would be used for key positioning (QQI3 = 4 for QQRID = 3001) and, as a result, performance would be faster.

History
Last changed by/on SAP  20070813 
SAP Release Created in