Question

In Caché ObjectScript (Intersystems' dialect of MUMPS), is there a way to efficiently skip to the approximate midpoint or a linear point in the key for a global subscript range? Equal, based on the number of records.

I want to divide up the the subscript key range into approximately equal chunks and then process each chunk in parallel.

Knowing that the keys in a global are arranged in a binary tree of some kind, this should be a simple operation for the underlying data storage engine but I'm not sure if there is an interface to do this.

I can do it by scanning the global's whole keyspace but that would defeat the purpose of trying to run the operation in parallel. A sequential scan takes hours on this global. I need the keyspace divided up BEFORE I begin scanning.

I want each thread will to an approximately equal sized contiguous chunk of the keyspace to scan individually; the problem is calculating what key range to give each thread.

Was it helpful?

Solution 2

For my particular need, I found that the application I'm using has what I would call an index global. Another global maintained by the app with different keys, linking back to the main table. I can scan that in a fraction of the time and break up the keyset from there.

If someone comes up with a way to do what I want given only the main global, I'll change the accepted answer to that.

OTHER TIPS

you can use second parameter "direction" (1 or -1) in function $order or $query

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top