5-22 IBM Informix OnLine Database Server Administrator’s Guide

Psort Parallel-Process Sorting Package

Psort Parallel-Process Sorting Package
Psortis a sorting package that improves performance by taking advantage of
multiprocessors to start and synchronize multiple sort processes. This
parallel-process sorting package is transparent to end users. (If you are
working on a uniprocessor machine and you set any of theparallel-sort
parameters, OnLine ignores the parameters and proceeds with nonparallel
sorting.)
Psort becomes an option for OnLine under either of threeconditions:
Thedatabase server process is ordering query results. (An ORDER BY
clause appears as part of a SELECT statement.)
Thedatabase server process is eliminating duplicates. (The UNIQUE
orDISTINCT keyword appears in the SELECT statement.)
The database server process is executing a sort-merge join, a new
multitablejoin method that is used with the older “nested-loop” join
method.

How Psort Works

Toenable Psort, set the PSORT_NPROCS environment variable, which defines
the upper limit for the number of processes used to sort a query. To disable
Psort, unset the PSORT_NPROCS environment variable. (Refer to the next
topic for guidelines for setting the value of PSORT_NPROCS.)
IfPsort is enabled, OnLine performs parallel sorting only when performance
is likely to improve. OnLine does not employ parallel sorting for a small
numberof input rows or if a table index supports the order requested in the
query.
If OnLine engages Psort, multiple sorted runs are made in memory, written
todisk, and then merged from disk into a single result stream. OnLine calcu-
latesthe number of processes to use in the sort based on the size of the query
andthe number of processors on the system. You can tune Psort by limiting
the maximum number of processes available to OnLine and by directing
OnLine to use directories on different disks for the intermediate writes.