10. Choosing Storage Structures and Secondary Indexes : Hash Storage Structure : Retrievals Supported by Hash
 
Share this page                  
Retrievals Supported by Hash
The hash storage structure allows multi-column keys, but every column in the key must be specified in a query to take advantage of the hash access method. For instance, to hash the employee table on both age and name, use the Structure of Table dialog.
Alternatively, use the following MODIFY statement:
modify employee to hash on age,name;
The following queries make use of the hash key:
select * from employee
  where employee.age = 28
  and employee.name = 'Gordon';
select * from employee
  where employee.age = 28
    and employee.name = 'Gordon'
  or employee.age = 29
    and employee.name = 'Quan';
The next queries do not use the hash key, because the entire key has not been specified:
select * from employee
  where employee.age = 28;
select * from employee
  where employee.name = 'Gordon';
select * from employee
  where employee.age = 28
  and employee.name like 'Gor%';
select * from employee
  where employee.age = 28
  or employee.name = 'Gordon';