Do I need to switch to the alpha node of the corresponding group to query the information in different groups

I have the following two questions:
We know that dgraph is sliced according to its attributes,

  1. Why are the data added in the same group?
  2. If I manually put the name into group2, I need to switch the alpha server in group2 to get the name information. Do I need to switch the alpha service node dynamically during the development process?

Hi @tss,

Yes, the data is sharded according to predicate.

As each shard contains a whole predicate in its entirety, Dgraph shards can be of uneven size. As Dgraph groups contain many shards, even groups can be of uneven sizes.
As sizes of shards grow big and reach a certain limit, rebalancing of shards will occur which will then move some of the shards to different groups. I see that currently each shard has size < 64 MB which is not that big.

I understand the question as to whether all queries to get name information will have to be routed by the user to a different alpha node in case ‘name’ is manually moved into different group.
Answer to this question is ‘No’ . As shards are moved between different groups (manually or due to rebalancing), the ‘zero’ group maintains the group to which a shard belongs to. Queries made to get ‘name’ information from any alpha node will be directed to the group containing ‘name’ by zero group.
No such dynamic shifting of alpha service node is needed.

1 Like

thanks for your reply!