Exploring Multiple Data Models with Globals
InterSystems IRIS® data platform contains an extremely efficient data model known as globals. Data added to globals is immediately stored and available to multiple processes, not just the process that stored it.
A global is a persistent multidimensional array of nodes. Nodes referred to as leaf nodes contain only data. Some nodes contain a set of child nodes, which is why globals are typically depicted as a hierarchical tree.
A subscript is an identifier for a child node. A unique subscript must specify each child node of the parent because child nodes are in the same subscript level or dimension of the global. Likewise, a list of subscripts specifies a unique node within a multi-level or multidimensional global.
The benefits of using globals are vast—some are listed below.
- Efficient: Globals grow based on need, without upfront declaration of size or structure.
- Multimodel: Leaf nodes can store objects, tables and indexes, JSON and XML documents, even documentation.
- Typeless: Subscripts, even those at the same subscript level, can be integers, strings, and decimals.
- Automatically sorted: Globals sort subscripts automatically at each dimension.
- Flexible: Globals allow flexibility in node structure and data storage to contain any number of subscripts and any type of data.
- Safe: You can lock any node to keep other processes from changing value while keeping other nodes at same level accessible.
Note that globals are not just another storage model. In fact, they are so powerful and flexible that they are actually at the core of all InterSystems models, giving you freedom from database remodels.
In this exercise, you will examine the globals used to store data for objects of a class of U.S. states. Properties of the class include the name of the state, its two-letter postal abbreviation, its capital, the year it was established, and its area (in square miles). Then you will access and store objects of this class using relational and object techniques, as well as by manipulating the globals directly.