Page tree
Skip to end of metadata
Go to start of metadata







Oracle does not recommend using the SORT_AREA_SIZE parameter unless the instance is configured with the shared server option. Oracle recommends that you enable automatic sizing of SQL working areas by setting PGA_AGGREGATE_TARGET instead. SORT_AREA_SIZE is retained for backward compatibility.

The key cost here is reduced server speed from setting this too high. Many common recommendations to use several megabytes or more have been made in a wide range of published sources and these are harmful for OLTP workloads. that normally benefit most from 32k or other small values. Do not set this to significantly larger values such as above 256k unless you see very excessive numbers of Sort_merge_passes - many hundreds or thousands per second on busy servers. Even then, it is far better to adjust the setting only in the connection of the few queries that will benefit from the larger size. In cases where it is impossible to adjust settings at the session level and when the workload is mixed it can be useful to use higher than ideal OLTP values to address the needs of the mixture of queries.

Specifies the amount of memory to be used by internal sort operations and hash tables before writing to temporary disk files. The value defaults to four megabytes (4MB). Note that for a complex query, several sort or hash operations might be running in parallel; each operation will be allowed to use as much memory as this value specifies before it starts to write data into temporary files. Also, several running sessions could be doing such operations concurrently. Therefore, the total memory used could be many times the value of work_mem; it is necessary to keep this fact in mind when choosing the value. Sort operations are used for ORDER BY, DISTINCT, and merge joins. Hash tables are used in hash joins, hash-based aggregation, and hash-based processing of IN subqueries.


如果是自动管理PGA内存,那么对于OLTP系统,建议设置PAG=(机器内存 × 80% )× 20%






该值默认为四个兆字节(4MB)。请注意,对于复杂的查询,可能会并行运行多个排序或哈希操作。在开始将数据写入临时文件之前,每个操作将被允许使用此值指定的内存量。同样,几个正在运行的会话可能会同时进行此类操作。因此,使用的总内存可能是work_mem的许多倍;选择值时必须牢记这一事实。排序操作用于ORDER BY,DISTINCT和合并联接。哈希表用于IN子查询的哈希联接,基于哈希的聚合和基于哈希的处理。

  • No labels