Table 26-1 shows the number of producers and consumers required to create indexes. The target segment for a sort is the segment where the index is stored when the create index command completes. When you create an index, you can specify the location with the on segment_name clause. If you do not specify a segment, the index is stored on the default segment.
Index type |
Producers |
Consumers |
---|---|---|
Nonclustered index |
Number of partitions, or 1 |
Number of devices on target segment |
Clustered index on unpartitioned table |
1 |
Number of devices on target segment |
Clustered index on partitioned table |
Number of partitions, or 1 |
Number of partitions |
Consumers are the workhorses of parallel sort, using CPU time to perform the actual sort and using I/O to read and write intermediate results and to write the final index to disk. First, the sort manager assigns one worker process as a consumer for each target device. Next, if there are enough available worker processes, the sort manager assigns one producer to each partition in the table. If there are not enough worker processes to assign one producer to each partition, the entire table is scanned by a single producer.
To create a clustered index on a partitioned table, Adaptive Server requires at least one consumer process for every partition on the table, plus one additional worker process to scan the table. If fewer worker processes are available, then the create clustered index command fails and prints a message showing the available and required numbers of worker processes.
If enough worker processes are available, the sort manager assigns one producer process per partition, as well as one consumer process for each partition. This speeds up the reading of the data.
Minimum |
1 consumer per partition, plus 1 producer |
Maximum |
2 worker processes per partition |
Can be performed in serial |
No |
Only one producer process can be used to scan the input data for unpartitioned tables. The number of consumer processes is determined by the number of devices on the segment where the index is to be stored. If there are not enough worker processes available, the sort can be performed in serial.
Minimum |
1 consumer per device, plus 1 producer |
Maximum |
1 consumer per device, plus 1 producer |
Can be performed in serial |
Yes |
The number of consumer processes is determined by the number of devices on the target segment. If there are enough worker processes available and the table is partitioned, one producer process is used for each partition on the table; otherwise, a single producer process scans the entire table. If there are not enough worker processes available, the sort can be performed in serial.
Minimum |
1 consumer per device, plus 1 producer |
Maximum |
1 consumer per device, plus 1 producer per partition |
Can be performed in serial |
Yes |