How to separate data

There is a same type of node for each group and I created an index on 'id' of that node.
But the nodes in each group are totally separated and no usage of sharing them. So I'm wondering which one is good to create indices.

  1. create one index for all nodes even if each group nodes are separated
  2. create separated indices for the nodes of each group

When I tried #1, there are a lot of racing to access the index when I import multiple group's data at the same time, which slows performance
To implement #2, I need to differentiate node names even if they are same like node_group1, node_group2... Is this a right solution?

I'm not sure what is the best way to manage separate data in a database.
Hope to get some advice.
Thanks
Alex Ough

could you give an example, e.g. CREATE statements for miniature example of your database?

If I'm not mistaken you have one Label on all the nodes, and then an .id property which is indexed for that Label? Do you use an indexed .group property as well, to select for a group?

Note, you can apply more than one Label to a node, there are many options, the best answer quite likely depends on your specific usage needs.

Hi Joel,
Thanks for your reply.

Let's say there is a node with label of 'node1' in every organization and the node is created every day with different id. For fast search performance, I created an index on 'id' of 'node1', so whenever my application is creating a new node, the index needs to be updated to add 'id' of the new node, which cause competition among applications that are running concurrently.

But I want to reduce the competition by separating 'node1' nodes of different organization because the nodes are never shared among organizations.

I hope this helps you understand my cases and can you send detail information related with indexed.group property?

Thanks
Alex Ough

One trick that could help you, is to use multiple labels for a Node.

You could then have:

CREATE (a:Label:Org1 {id: 1})
CREATE (b:Label:Org2 {id: 2})

so that a is a mix of Org1 and Label, etc.

Then:

CREATE(n:Org1 {id: x}) or CREATE(n:Org2 {id: x}) to restrict to a specific Org.

CREATE(n:Label {id: x}) if you didn't care which org the node was in.

You'll have to do some performance measurements, but I suspect that:

CREATE INDEX org1_id IF NOT EXISTS FOR (n:Org1) ON (n.id);
CREATE INDEX org2_id IF NOT EXISTS FOR (n:Org2) ON (n.id);

is what you want.

Hi clem,
Thanks for your reply.

What I don't want is to use different labels for each org, which forces me to use different labels for each org when I implement cyphers for searches even if they are basically same.

Thanks
Alex Ough