Globals

Syndicate content 10 

Globals, these magic swords for storing data, have been around for a while, but not many people can use them efficiently or know about this super-weapon altogether.

If you use globals for tasks where they truly shine, the results may be amazing, either in terms of increased performance or dramatic simplification of the overall solution (1, 2).

Globals offer a special way of storing and processing data, which is completely different from SQL tables. They were first introduced in 1966 in the M(UMPS) programming language, which was initially used in medical databases. It is still used in the same way, but has also been adopted by some other industries where reliability and high performance are top priorities: finance, trading, etc.

Later M(UMPS) evolved into Caché ObjectScript (COS). COS was developed by InterSystems as a superset of M. The original language is still accepted by developers' community and alive in a few implementations. There are several signs of activity around the web: MUMPS Google group, Mumps User's group), effective ISO Standard, etc.

Modern global based DBMS supports transactions, journaling, replication, partitioning. It means that they can be used for building modern, reliable and fast distributed systems.

Globals do not restrict you to the boundaries of the relational model. They give you the freedom of creating data structures optimized for particular tasks. For many applications reasonable use of globals can be a real silver bullet offering speeds that developers of conventional relational applications can only dream of.

Globals as a method of storing data can be used in many modern programming languages, both high- and low-level. Therefore, this article will focus specifically on globals and not the language they once came from.

Last comment 31 July 2017
+ 12   0 4
1285

views

+ 12

rating

The Art of Mapping Globals to Classes  (2 of 3)

 

If you are looking to breathe new life into an old MUMPS application follow these steps to map your globals to classes and expose all that beautiful data to Objects and SQL.

 

This example is going to cram in 4 or 5 different things beyond what was covered in Part 1 

Last comment 23 May 2017
+ 10   0 6
1174

views

+ 10

rating

This post is the direct result of working with an InterSystems customer who came to me with the following problem:

SELECT COUNT(*) FROM MyCustomTable

Takes 0.005 seconds, total 2300 rows.  However:

Last comment 1 November 2016
+ 10   0 11
982

views

+ 10

rating

Order is a necessity for everyone, but not everyone understands it in the same way
(Fausto Cercignani)

Disclaimer: This article uses Russian language and Cyrillic alphabet as examples, but is relevant for anyone who uses Caché in a non-English locale.
Please note that this article refers mostly to NLS collations, which are different than SQL collations. SQL collations (such as SQLUPPER, SQLSTRING, EXACT which means no collation, TRUNCATE, etc.) are actual functions that are explicitly applied to some values, and whose results are sometimes explicitly stored in the global subscripts. When stored in subscripts, these values would naturally follow the NLS collation in effect (“SQL and NLS Collations”).

Last comment 10 June 2016
+ 9   0 0
1625

views

+ 9

rating

The Art of Mapping Globals to Classes (3 of 3)

 

If you are looking to breathe new life into an old MUMPS application follow these steps to map your globals to classes and expose all that beautiful data to Objects and SQL.

 

If the above does not sound familiar to you please start at the beginning with the following:

 

The Art of Mapping Globals 1

Last comment 2 November 2017
+ 8   0 7
865

views

+ 8

rating

In the previous parts (1, 2) we talked about globals as trees. In this article, we will look at them as sparse arrays.

A sparse array - is a type of array where most values assume an identical value.

In practice, you will often see sparse arrays so huge that there is no point in occupying memory with identical elements. Therefore, it makes sense to organize sparse arrays in such a way that memory is not wasted on storing duplicate values.

In some programming languages, sparse arrays are part of the language - for example, in J, MATLAB. In other languages, there are special libraries that let you use them. For C++, those would be Eigen and the like.

Globals are good candidates for implementing sparse arrays for the following reasons:

Last comment 23 May 2019
+ 6   0 5
625

views

+ 6

rating

Beginning - see Part 1.

 

3. Variants of structures when using globals

 

A structure, such as an ordered tree, has various special cases. Let's take a look at those that have practical value for working with globals.

 

 

 

 

3.1 Special case 1. One node without branches

 

Last comment 8 July 2017
+ 6   0 5
822

views

+ 6

rating

The Art of Mapping Globals to Classes (4 of 3)

The forth in the trilogy, anyone a Hitchhikers Guide to the Galaxy fan?

If you are looking to breathe new life into an old MUMPS application follow these steps to map your globals to classes and expose all that beautiful data to Objects and SQL.

If the above does not sound familiar to you please start at the beginning with the following:

The Art of Mapping Globals to Classes (1 of 3)

Last comment 12 June 2018
+ 5   0 6
877

views

+ 5

rating

It's well-known that namespace global mapping helps us to write code independent on database storage details (Caché instance name, directory path). But sometimes we can face problems accessing an unsubscripted global which has subscript level mapping (SLM) defined. Most of such cases are evident and associated with administrative tasks that should be done on database level, but some of them can confuse even an experienced developer. Just to start:

Last comment 13 October 2018
+ 4   0 3
616

views

+ 4

rating

Process-private Globals  can be used as a data global in storage definition. That way, each process can have its own objects for the class with ppg storage. For example lets define a pool, which can:

  • add elements to a pool (ignoring duplicates)
  • check if an element exists in the pool

Here's the class:

Last comment 16 August 2016
+ 4   0 3
409

views

+ 4

rating

Is there something in Cache that is equivalent to partitioning a table in Oracle? I'm trying to break some big tables into groups so that the most frequently accessed data is faster to retrieve.

Here is some information on this concept from Oracle.

https://docs.oracle.com/cd/B28359_01/server.111/b32024/partition.htm

Last answer 28 April 2016 Last comment 23 March 2018
+ 3   0 1
486

views

+ 3

rating

Hi Everyone,

Link to webinar recording: https://learning.intersystems.com/course/view.php?id=623

Thank you for your interest in this webinar!

Please submit questions about the content of the webinar as comments below this article.

Last comment 16 May 2017
+ 3   0 1
363

views

+ 3

rating

Now, let’s say you can’t access the terminal or simply you just rather execute it from a web interface. In this article, I will show you how to execute terminal commands from a simple web page.

For example, in the image below you see how we execute $zv on a webpage:

Last comment 13 October 2016
+ 2   0 0
5746

views

+ 2

rating

It is my understanding that when a routine accesses a global it is temporarily stored in global memory. While the global is within global memory, any other routine would be able to readily access the global from memory and not from disk so long as the same node is being utilized.

Last answer 12 July 2017 Last comment 17 July 2017
+ 2   0 1
195

views

+ 2

rating

Hi Community!

Please welcome a new video on InterSystems YouTube Channel:

InterSystems and Python QuickStart

 

+ 1   1 1
0

comments

106

views

+ 1

rating

I am still working on a generic task where I need to apply journal file records to another database. Initially I didn't want to use Journal.Restore class methods as I need to perform some data transformation, and it seemed that the clearest way to achieve it was to read journal file record by record using %SYS.Journal.Record API. 

Last answer 16 June 2018 Last comment 16 June 2018
+ 1   0 2
135

views

+ 1

rating

Is there a way to pull a user name and password from the Credentials list that is kept in Ensemble? Right now I have a LDAP user that I have hard coded into my ZAUTHENTICATE, which I would like to get away from. I am not to familiar with settings Global, or calling them at least.

Thanks

Scott

Last answer 24 February 2018 Last comment 1 March 2018
+ 1   0 5
573

views

+ 1

rating

Usually I recommend to set the global buffer (GB) as large as possible in order to maintain in memory more globals as possible. I don't know if this is a standard recommendation, but I want to discuss what should be the best buffer size for a Ensemble instance that only process messages. 

Last answer 3 April 2017 Last comment 5 April 2016
+ 1   0 4
1229

views

+ 1

rating

Currently, we have an application running in one namespace ("Database B") that has globals and routines mapped to another database ("Database A"). After enforcing clean up on Database A, we found that 90% of the disk is free. We would like to compact Database A and release the unused space. However, we are running OpenVMS, which seems to be the issue.

For databases consisting of only globals, we are able to use ^GBLOCKCOPY; however, we need to ensure that the routines and mappings are also copied.

Last answer 23 March 2017 Last comment 9 January 2017
+ 1   0 0
420

views

+ 1

rating

If I were trying to access an index of a global variable, what time complexity would this operation have? My understanding of languages like Java/C++ is that arrays are stored as blocks of memory so that x[15] would have a lookup time complexity of O(1) because it just goes to (address of the array + 15) and retrieves the value stored there.

How does this work in Cache where the index of a variable isn't necessarily an integer value? If I were to have a variable like the following:

x("Adam") = "Red"

x("George") = "Blue"

x("Bryan") = "Green"

etc...

Last answer 6 February 2017 Last comment 7 February 2017
+ 1   0 2
253

views

+ 1

rating

NewBie's Corner Session 27 Traversing A Global with $Order Part 1

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

Traversing A Global

Perhaps the most difficult concept in Caché/MUMPS is its Global Structure. This session and several that follow it deals with the Global Structure. However, just presenting the material will not guarantee your understanding of it. You must experiment with the data and concepts that are presented.

Last comment 4 October 2016
-1   0 10
585

views

-1

rating