-
Notifications
You must be signed in to change notification settings - Fork 0
Tutorial: recordid
Previous : Tutorial: Clusters - Next: Tutorial: SQL Select
Each record in OrientDB has its own self-assigned unique ID within the database, called Record ID or RID that is composed of two parts:
#<cluster-id>:<cluster-position>
- cluster-id is the id of the cluster. Each database can have a maximum of 32,767 clusters (2^15)
- cluster-position is the position of the record inside the cluster. Each cluster can handle up to 9,223,372,035,000,000,000 (2^63) records.
So the maximum size of a database is 2^78 records = 302,231,454,903,657,000,000 records. We never tested such numbers because the lack of hw resources, but we know for sure there are OrientDB users that have databases with Billions of records.
A RID (RecordID) is the physical position of the record inside the database. This means that loading a record by its RID it's blazing fast with response time close to be constant O(1) even if the database grows. This is huge in the BigData age!
To load directly a record via the console use the Load record command. Below we load the record #12:4 of "demo" database.
orientdb> load record #12:4
--------------------------------------------------
ODocument - Class: Company id: #12:4 v.8
--------------------------------------------------
addresses : [NOT LOADED: #19:159]
salary : 0.0
employees : 100004
id : 4
name : Microsoft4
initialized : false
salary2 : 0.0
checkpoint : true
created : Sat Dec 29 23:13:49 CET 2012
The Load record command returns some useful information about this record:
- It's a document. OrientDB supports different types of records, but this tutorials covers documents only
- The class is "Company"
- The current version is 8. OrientDB has a MVCC system, but for now forget about it. Just know that every time you update a record its version is incremented by 1
- we've different field types, "salary" and "salary2" are floats, "employees" and "id" are integers, "name" is a string, "initialized" and "checkpoint" are booleans and "created" is a date-time
- the field "addresses" has been not loaded and it's a LINK to another record #19:159. This is a relationship!
Previous : Tutorial: Clusters - Next: Tutorial: SQL Select