Creating each record into its own cluster

66 views
Skip to first unread message

Mihai Ocneanu

unread,
Mar 30, 2016, 8:56:56 AM3/30/16
to orient-...@googlegroups.com
Normally, each class has its own cluster.

 -  Would there be an incentive for each record (each instance) of that class to have its own cluster? I see none, but I gotta ask.

 - Also, does the Java API allow manipulations (create/delete cluster, create vertex into a specific cluster, etc) to work with clusters, or should you use the SQL commands?

Thanks,
Mihai

alessand...@gmail.com

unread,
Mar 30, 2016, 11:33:54 AM3/30/16
to OrientDB
Hi Mihai,
to create a cluster with java api you can use the following code

OClass cl=g.createVertexType("Customer");
cl
.createProperty("name", OType.STRING);
cl
.addCluster("usa_customer");
cl
.addCluster("china_customer");

while to insert a record in a specific cluster you can use this code

OrientVertex v1=g.addVertex("Customer","china_customer");
v1
.setProperty("name","Alessandro");

or

OrientVertex c1=g.addVertex("Customer");
c1
.setProperty("name","Alessandro");
c1
.moveTo("Customer", "usa_customer");

Hope it helps.

Mihai Ocneanu

unread,
Mar 30, 2016, 11:52:24 AM3/30/16
to OrientDB
Hi Alessandro,

And thanks for the reply, it's helpful re: the java API.

Regarding my first question, do you see any reason why you'd want each instance/record to exist in its own cluster? In your example, the each customer whould have his own cluster..?


Thanks again,
Mihai

Ivan Mainetti

unread,
Mar 30, 2016, 12:02:11 PM3/30/16
to OrientDB

SavioL

unread,
Mar 31, 2016, 5:37:19 AM3/31/16
to OrientDB
The cluster is nothing but a grouping of records. The equivalent of the relational world would be a table. In object-oriented model of OrientDB all instances of a class are stored in a clustered ad hoc. By convention, the name of the cluster and the class match, but you can change the schema at any time.

scott molinari

unread,
Mar 31, 2016, 7:14:51 AM3/31/16
to OrientDB
I think of clusters and classes like this.

A class is only a logic container for data. The cluster, however, is a logical location for the data. (Someone from ODB correct me, if my thinking is wrong).

It makes no sense whatsoever to have a cluster per instance/record. Though, I am also not completely certain what you mean with the instance part.

In the end, you can use clusters for data locality within your server cluster. This helps, for instance, when your userbase is global and your database becomes large and you want to spread the data across the globe. Though, these kinds of contemplations come very late in a scaling out scenario.

Scott  

Mihai Ocneanu

unread,
Mar 31, 2016, 8:56:05 AM3/31/16
to OrientDB
Thank you, Scott.

It didn't make any sense to me either but I wanted to have another opinion or basically know, if there was any situation where you'd want one cluster for one record [?!?]

Tx,
Mihai

scott molinari

unread,
Apr 1, 2016, 4:14:32 AM4/1/16
to OrientDB
Being ODB limits the clusters to about 32K, it wouldn't make much sense from that aspect either.

http://orientdb.com/docs/2.1/Limits.html

Scott

Fabio Rinnone

unread,
Apr 15, 2016, 9:13:58 AM4/15/16
to orient-...@googlegroups.com
Il 30/03/2016 17:33, alessand...@gmail.com ha scritto:
> while to insert a record in a specific cluster you can use this code
>
> |
> OrientVertexv1=g.addVertex("Customer","china_customer");
> v1.setProperty("name","Alessandro");
> |

There is a way to do this operation using oetl scripts to load vertices
from CSV file?

At this moment I'm only able to load all CSV files in only one cluster
and later I create all others cluster and I move vertices to correct
clusters. But my database is very big and moving operation is very slow.

I'm sorry but I'm very frustated and I don't know how to do.

Thank you.

--
Fabio Rinnone
Skype: fabiorinnone
Web: http://www.fabiorinnone.eu

signature.asc
Reply all
Reply to author
Forward
0 new messages