Start - see part 1.3. Variants of structures when using globals
Such a structure as an ordered tree has different special cases. Consider those that have practical value when working with globals.
3.1 Special case 1. One node without branches

Globals can be used not only like an array, but also as ordinary variables. For example, as a counter:
')
Set ^counter = 0 ;
Set id=$Increment(^counter) ;
, , . .
3.2 2.
— key-value . , .

, . :
- -.
Set ^t(id1) = "col11/col21/col31"
Set ^t(id2) = "col12/col22/col32"
- , . .
- $LB ( Cache), .
Set ^t(id1) = $LB("col11", "col21", "col31")
Set ^t(id2) = $LB("col12", "col22", "col32")
, . . — , . .
.
Set ^i("col11", id1) = 1
Set ^i("col12", id2) = 1
^i (id) .
. .
TSTART
Set ^t(id1) = $LB("col11", "col21", "col31")
Set ^i("col11", id1) = 1
TCOMMIT
c M
,
.
( ), // COS/M .INSERT SELECT , TSTART TCOMMIT ().
.
778 361 /.
300 — 422 141 /.
— 572 082 / 50 . M-.
, SSD. RAID5 Write-back. Phenom II 1100T.
SQL- , . MySQL 5.5 ( InnoDB) , 11 .
, , . SQL- .

, , , SQL, .

,
. , . ,
key-value, , , , - .- , .
3.3 3. ,

, , : . .
vs. . |
---|
| |
---|
- , .
- . ( ) .
| - , . 11,5% 2- .
|
: . — , , .
3.4 .
, , .
3.4.1

. , , , . . , 99% .
SQL : «» ~ 100 000 , «» — 100 000 , «» — 100 000 , «» — 100 000 .. .. , ( !), , , .
, , , , , , .
, . , , ,
.
, SQL (
EAV,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10), . . () (SQL). .
, (ALTER TABLE) . MySQL, , ALTER TABLE ADD|DROP COLUMN ( MyISAM, InnoDB). , .
, , . , . .
, , — .
, , — , B-tree.
, , - , . - .
, , MongoDB.
:
- . JSON ( BSON) 16. , JSON- , JSON-, . . . 16 , , . . , .
- // . ( !), BSON, // , , BSON, . .
- . , B-tree. BSON , .
3.3.2
( ) . PHP 3.3.1.
$a = array(
"name" => "Vince Medvedev",
"city" => "Moscow",
"threatments" => array(
"surgeries" => array("apedicectomy", "biopsy"),
"radiation" => array("gamma", "x-rays"),
"physiotherapy" => array("knee", "shoulder")
)
);
3.3.3 : XML, JSON
. .
XMLXML , . , .

<note id=5>
<to></to>
<from></from>
<heading></heading>
<body> !</body>
</note>
COS :
Set ^xml("note")="id=5"
Set ^xml("note","to")=""
Set ^xml("note","from")=""
Set ^xml("note","heading")=""
Set ^xml("note","body")=" !"
: XML, JSON, . note.
^xml . , , :
JSON.3.3.1 JSON-:
var document = {
"name": "Vince Medvedev",
"city": "Moscow",
"threatments": {
"surgeries": ["apedicectomy", "biopsy"],
"radiation": ["gamma", "x-rays"],
"physiotherapy": ["knee", "shoulder"]
},
};
3.3.4 ,
: , -, .
. . , . .
, . . , . , .

4.
, , .
| / |
---|
- [ ], [ ]
- ,
- ,
| - / [/ ] /
- (schema-less). .
- .
- . .
|
« — - . . 3».
Disclaimer: InterSystems.