Book Image

Couchbase Essentials

Book Image

Couchbase Essentials

Overview of this book

Table of Contents (15 chapters)
Couchbase Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Key design


With Couchbase, you can't have a document without a key. Therefore, it's clearly important to have a strategy for key design. How you choose to generate your keys will, generally, be partly preference driven and partly use case driven. We'll start by examining what basic requirements exist for keys in Couchbase.

Keys, metadata, and RAM

We saw previously that Couchbase keys are parts of the metadata of a document. This fact was revealed as we explored views that used the meta argument in map functions to retrieve document IDs for indexes. Prior to Couchbase Server 3.0, all keys were kept in the memory even if their documents weren't. Therefore, longer keys required more memory. Since Couchbase performs best when documents are kept in the memory, smaller keys mean more RAM available for documents.

In Couchbase Server 3.0, keeping metadata in the memory is still the default behavior, but it is now tunable. While you're now able to delete metadata from the memory for documents that have...