11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Caché</strong> <strong>ObjectScript</strong> FunctionsSee Also• $CASE function$SORTBEGINInitiates a sorting mode to improve performance of multiple sets to a global.$SORTBEGIN(set_global)Parametersset_globalA global variable name.Description$SORTBEGIN initiates a special sorting mode during which sets to the specified targetglobal are redirected to a process-private temporary area and sorted into subsets. This modeis 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 ofits descendants are affected.$SORTBEGIN 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 ofdata written approaches or exceeds the amount of available buffer pool memory, performancecan suffer drastically. $SORTBEGIN solves this problem by guaranteeing that data is writtento the target global in sequential order, thus minimizing the number of physical disk accessesneeded. It does this by writing and sorting data into one or more temporary buffers (usingspace in the ^CacheTemp global if needed) and then, when $SORTEND is called, copyingthe data sequentially into the target global.While $SORTBEGIN is in effect, data read from the target global will not reflect any setoperations. You cannot use $SORTBEGIN in cases where you need to read global valuesfrom the same global in which you are inserting values.<strong>Caché</strong> Objects and <strong>Caché</strong> SQL applications automatically make use of $SORTBEGIN forindex and temporary index creation.The $SORTBEGIN sorting mode can be terminated without writing data to the target globalby calling $SORTEND with it optional second parameter set to 0.298 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!