Initiates a sorting mode to improve performance of multiple sets to a global.
initiates a special sorting mode during which SET
operations to the specified target global are redirected to a process-private temporary area and sorted into subsets. This mode is ended with a call to $SORTEND
which copies the data into the target global reference. When the special sorting mode is in effect, all sets to the target global reference and any of its descendants are affected.
is designed to help the performance of operations, such as index building, where a large amount of unordered data needs to be written to a global. When the amount of data written approaches or exceeds the amount of available buffer pool memory, performance can suffer drastically. $SORTBEGIN
solves this problem by guaranteeing that data is written to the target global in sequential order, thus minimizing the number of physical disk accesses needed. It does this by writing and sorting data into one or more temporary buffers (using space in the IRISTEMP
database if needed) and then, when $SORTEND
is called, copying the data sequentially into the target global.
is in effect, data read from the target global will not reflect any SET
operations. You cannot use $SORTBEGIN
in cases where you need to read global values from the same global in which you are inserting values.
InterSystems IRIS object and InterSystems SQL applications automatically make use of $SORTBEGIN
for index and temporary index creation.
sorting mode can be terminated without writing data to the target global by calling $SORTEND
with it optional second parameter set to 0.
If successful, $SORTBEGIN
returns a nonzero integer value. If unsuccessful, $SORTBEGIN
Sorting Mode Errors
Invoking some operations between the $SORTBEGIN
result in InterSystems IRIS issuing an error code:
If you establish a $SORTBEGIN
global, and then issue a $SORTBEGIN
for an ancestor or descendent of that global, InterSystems IRIS issues a <DUPLICATEARG> error. For example, if you invoke $SORTBEGIN(^test(1,2,3))
, the following function calls result in a <DUPLICATEARG> error: $SORTBEGIN(^test(1,2))
Content Date/Time: 2019-04-23 13:43:22