Shoudl I split my db into many buckets in this case

Should I store all kind of object in a single bucket?
I have search and find many answers on SO that saying yes, but also found this note on CouchBase "Views best practices"
I not a really good idea for a large database. What I wonder is if our db can be that ‘large’: What we (will) have:

  • 1 milions user object.
  • Whenever user login, a token object will be make and maybe keep for
    month. User can login at the same time on mutilple devices so they
    will have many token object.
  • A few meta-data object like user role and role’s permissions.

In general a Bucket is synonymous with a Database in an RDBMS, so you would typically put multiple Tables -worth of data in a single Bucket.

Considering your workload, in addition to the number of documents in the system you also want to look at mutation rates - that is generally the constraining factor in Views performance, as each Design Document needs to consider (i.e. run the map & reduce functions on) every change which occurs in a bucket.

1 Like