ParallelMergeOptions Enum


指定要在查询中使用的首选输出合并类型。Specifies the preferred type of output merge to use in a query. 换而言之,它指示 PLINQ 应如何将来自各个分区的结果合并回单个结果序列。In other words, it indicates how PLINQ should merge the results from the various partitions back into a single result sequence. 这只是一个提示,并且在对所有查询进行并行化时系统可能不会遵循此提示。This is a hint only, and may not be respected by the system when parallelizing all queries.

public enum class ParallelMergeOptions
public enum ParallelMergeOptions
type ParallelMergeOptions = 
Public Enum ParallelMergeOptions


AutoBuffered 2

利用系统选定大小的输出缓冲区进行合并。Use a merge with output buffers of a size chosen by the system. 在向查询使用者提供结果之前,会先将结果累计到输出缓冲区中。Results will accumulate into an output buffer before they are available to the consumer of the query.

Default 0

使用默认合并类型,即 AutoBuffered。Use the default merge type, which is AutoBuffered.

FullyBuffered 3

利用整个输出缓冲区进行合并。Use a merge with full output buffers. 在向查询使用者提供任何结果之前,系统会先累计所有结果。The system will accumulate all of the results before making any of them available to the consumer of the query.

NotBuffered 1

不利用输出缓冲区进行合并。Use a merge without output buffers. 一旦计算出结果元素,就向查询使用者提供这些元素。As soon as result elements have been computed, make that element available to the consumer of the query.


NotBuffered 用于将作为流使用和输出的查询,这在开始执行查询和生成的元素之间延迟时间最低。Use NotBuffered for queries that will be consumed and output as streams, this has the lowest latency between beginning query execution and elements being yielded. 对于某些查询(如涉及排序(OrderBy,OrderByDescending)的查询),缓冲是必需的,并且将忽略 NotBuffered 或 AutoBuffered 的提示。For some queries, such as those involving a sort (OrderBy, OrderByDescending), buffering is essential and a hint of NotBuffered or AutoBuffered will be ignored. 但是,只要不在查询本身中执行进一步的排序,就可以对使用 AsOrdered 运算符创建的查询进行流式处理。However, queries that are created by using the AsOrdered operator can be streamed as long as no further sorting is performed within the query itself.

在大多数情况下使用 AutoBuffered;这是默认值。Use AutoBuffered for most cases; this is the default. 它在延迟与整体性能之间取得平衡。It strikes a balance between latency and overall performance.

如果在需要信息之前可以处理整个输出,请使用 FullyBuffered 进行查询。Use FullyBuffered for queries when the entire output can be processed before the information is needed. 如果所有输出都可以在生成任何信息之前累计,则此选项可提供最佳性能,但它不适合用于流处理或显示部分结果中查询。This option offers the best performance when all of the output can be accumulated before yielding any information, though it is not suitable for stream processing or showing partial results mid-query.

Applies to

See also