v1.10

Document

How to Start SequoiaDB

Basic Operation

Data Model

Database Management

Aggregation

Index

Replication

Cluster

Connector

Reference

Development

Release Note

FAQ

  • Content
  • Comments
  • History

Collection Splitting

Concept

Sharded collection is a collection that has defined a sharding key. Sharded collection can split data in collection to more than one data sharding group according to the fields specified by sharding key.

When collection is generated, users can specify sharding key. Sharded collection is generated in a random data sharding group. User can split a collection to several data sharding groups by themselves.

Sharding Interval

Every interval in sharded collection is named sharding interval.

When a sharded collection is generated, the sharding group of it contains all the ranges, which include range from MinKey to MaxKey for all fields.

Every range is left-closed and right-open. That's to say, data in it is greater than or equal to the lower boundary and lesser than the upper boundary. For example:

{ LowBound: { "": 10 }, UpBound: { "": 20 } }

In this example, the lower boundary is 10 and the high boundary is 20. So all the data in this range for all the sharding field is greater than or equal to 10 and lesser than 20.

Note: The definition of all ranges within a collection does not contain field name. The fields in it are consistent with those defined in sharding key in terms of type and number.

When a sharding key contains several fields, the matching principle is to match first field ahead. If it is located in boundary, it will match the next field. For example,

{ LowBound: { "": 10, "": 5 }, UpBound: { "": 20, "": 1 } }

In this shardin range, if the sharding key users input is located between 10 and 20, it is judged to belong to this range.If it is lesser than 10 or greater than 20, it doesnt belong to this range. If it is 10 or 20, it will compare the second field with the principle of left-closed-right-open.

Rule

SYSCOLLECTIONS for more about the the definition principle of sharded collection.

Sample

A typical sharded range which exists in two sharding group is as follow:

  [ 
        { "GroupID" : 1000, 
          "LowBound" : { "" : MinKey, "" : MaxKey }, 
          "UpBound" : { "" : 10, "" : 5 } 
        }, 
        { "GroupID" : 1001, 
          "LowBound" : { "" : 10, "" : 5 }, 
          "UpBound" : { "" : MaxKey, "" : MinKey } 
        } 
  ]

The replset ID of the first range in this sample is 1000. The sample contains a sharding key with two fields:

  • lower boundary : { "" : MinKey, "" : MaxKey }
  • upper boundary:{ "" : 10, "" : 5 }

The replset ID of the second range in this sample is 1001. The sample contains a sharding key with two fields:

  • lower boundary : { "" : 10, "" : 5 }
  • upper boundary:{ "" : MaxKey, "" : MinKey }
please login to comment.
Latest Comment
  • 2015-02-15

About Us

SequoiaDB is a financial-level distributed database vendor and is the first Chinese database listed in Gartner’s Magic Quadrant OPDBMS report. SequoiaDB has recently released version 3.0.
SequoiaDB is now penetrating the vertical sector Financial Industry quickly and had more than 50 banking clients and hundreds of enterprise customers in industries including government, telecommunication, Internet and IoT.

Beijing:
Tower R, No.8 North Star East Road, Chaoyang District, Beijing,China
Guangzhou:
Tower A, No.22 Qinglan Street, Panyu District, Guangzhou,China
Shenzhen:
Tsing Hua Tech Park, Nanshan District, Shenzhen,China
Tel:400-8038-339
E-mail:contact@sequoiadb.com