Home > Store

NoSQL for Mere Mortals

Register your product to gain access to bonus material or receive a coupon.

NoSQL for Mere Mortals

eBook (Watermarked)

  • Your Price: $31.99
  • List Price: $39.99
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Acrobat® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.


  • Copyright 2015
  • Dimensions: 7" x 9-1/8"
  • Pages: 552
  • Edition: 1st
  • eBook (Watermarked)
  • ISBN-10: 0-13-402991-7
  • ISBN-13: 978-0-13-402991-7

The Easy, Common-Sense Guide to Solving Real Problems with NoSQL

The Mere Mortals® tutorials have earned worldwide praise as the clearest, simplest way to master essential database technologies. Now, there’s one for today’s exciting new NoSQL databases. NoSQL for Mere Mortals guides you through solving real problems with NoSQL and achieving unprecedented scalability, cost efficiency, flexibility, and availability.

Drawing on 20+ years of cutting-edge database experience, Dan Sullivan explains the advantages, use cases, and terminology associated with all four main categories of NoSQL databases: key-value, document, column family, and graph databases. For each, he introduces pragmatic best practices for building high-value applications. Through step-by-step examples, you’ll discover how to choose the right database for each task, and use it the right way.

Coverage includes

--Getting started: What NoSQL databases are, how they differ from relational databases, when to use them, and when not to Data management principles and design criteria: Essential knowledge for creating any database solution, NoSQL or relational

--Key-value databases: Gaining more utility from data structures

--Document databases: Schemaless databases, normalization and denormalization, mutable documents, indexing, and design patterns

--Column family databases: Google’s BigTable design, table design, indexing, partitioning, and Big Data

Graph databases: Graph/network modeling, design tips, query methods, and traps to avoid

Whether you’re a database developer, data modeler, database user, or student, learning NoSQL can open up immense new opportunities. As thousands of database professionals already know,  For Mere Mortals is the fastest, easiest route to mastery.

Sample Content

Table of Contents

Preface xxi

Introduction xxv


Chapter 1 Different Databases for Different Requirements 3

Relational Database Design 4

    E-commerce Application 5

Early Database Management Systems 6

    Flat File Data Management Systems 7

        Organization of Flat File Data Management Systems 7

        Random Access of Data 9

        Limitations of Flat File Data Management Systems 9

    Hierarchical Data Model Systems 12

        Organization of Hierarchical Data Management Systems 12

        Limitations of Hierarchical Data Management Systems 14

    Network Data Management Systems 14

        Organization of Network Data Management Systems 15

        Limitations of Network Data Management Systems 17

    Summary of Early Database Management Systems 17

The Relational Database Revolution 19

    Relational Database Management Systems 19

        Organization of Relational Database Management Systems 20

        Organization of Applications Using Relational Database Management Systems 26

        Limitations of Relational Databases 27

Motivations for Not Just/No SQL (NoSQL) Databases 29

    Scalability 29

    Cost 31

    Flexibility 31

    Availability 32

Summary 34

Case Study 35

Review Questions 36

References 37

Bibliography 37

Chapter 2 Variety of NoSQL Databases 39

Data Management with Distributed Databases 41

    Store Data Persistently 41

    Maintain Data Consistency 42

    Ensure Data Availability 44

        Consistency of Database Transactions 47

        Availability and Consistency in Distributed Databases 48

    Balancing Response Times, Consistency, and Durability 49

    Consistency, Availability, and Partitioning: The CAP Theorem 51

ACID and BASE 54

    ACID: Atomicity, Consistency, Isolation, and Durability 54

    BASE: Basically Available, Soft State, Eventually Consistent 56

    Types of Eventual Consistency 57

        Casual Consistency 57

        Read-Your-Writes Consistency 57

        Session Consistency 58

        Monotonic Read Consistency 58

        Monotonic Write Consistency 58

Four Types of NoSQL Databases 59

    Key-Value Pair Databases 60

        Keys 60

        Values 64

        Differences Between Key-Value and Relational Databases 65

    Document Databases 66

        Documents 66

        Querying Documents 67

        Differences Between Document and Relational Databases 68

    Column Family Databases 69

        Columns and Column Families 69

        Differences Between Column Family and Relational Databases 70

    Graph Databases 71

        Nodes and Relationships 72

        Differences Between Graph and Relational Databases 73

Summary 75

Review Questions 76

References 77

Bibliography 77


Chapter 3 Introduction to Key-Value Databases 81

From Arrays to Key-Value Databases 82

    Arrays: Key Value Stores with Training Wheels 82

    Associative Arrays: Taking Off the Training Wheels 84

    Caches: Adding Gears to the Bike 85

    In-Memory and On-Disk Key-Value Database: From Bikes to Motorized Vehicles 89

Essential Features of Key-Value Databases 91

    Simplicity: Who Needs Complicated Data Models Anyway? 91

    Speed: There Is No Such Thing as Too Fast 93

    Scalability: Keeping Up with the Rush 95

        Scaling with Master-Slave Replication 95

        Scaling with Masterless Replication 98

Keys: More Than Meaningless Identifiers 103

    How to Construct a Key 103

    Using Keys to Locate Values 105

        Hash Functions: From Keys to Locations 106

        Keys Help Avoid Write Problems 107

Values: Storing Just About Any Data You Want 110

    Values Do Not Require Strong Typing 110

    Limitations on Searching for Values 112

Summary 114

Review Questions 115

References 116

Bibliography 116

Chapter 4 Key-Value Database Terminology 117

Key-Value Database Data Modeling Terms 118

    Key 121

    Value 123

    Namespace 124

    Partition 126

    Partition Key 129

    Schemaless 129

Key-Value Architecture Terms 131

    Cluster 131

    Ring 133

    Replication 135

Key-Value Implementation Terms 137

    Hash Function 137

    Collision 138

    Compression 139

Summary 141

Review Questions 141

References 142

Chapter 5 Designing for Key-Value Databases 143

Key Design and Partitioning 144

    Keys Should Follow a Naming Convention 145

    Well-Designed Keys Save Code 145

    Dealing with Ranges of Values 147

    Keys Must Take into Account Implementation Limitations 149

    How Keys Are Used in Partitioning 150

Designing Structured Values 151

    Structured Data Types Help Reduce Latency 152

    Large Values Can Lead to Inefficient Read and Write Operations 155

Limitations of Key-Value Databases 159

    Look Up Values by Key Only 160

    Key-Value Databases Do Not Support Range Queries 161

    No Standard Query Language Comparable to SQL for Relational Databases 161

Design Patterns for Key-Value Databases 162

    Time to Live (TTL) Keys 163

    Emulating Tables 165

    Aggregates 166

    Atomic Aggregates 169

    Enumerable Keys 170

    Indexes 171

Summary 173

Case Study: Key-Value Databases for Mobile Application Configuration 174

Review Questions 177

References 178


Chapter 6 Introduction to Document Databases 181

What Is a Document? 182

    Documents Are Not So Simple After All 182

    Documents and Key-Value Pairs 187

    Managing Multiple Documents in Collections 188

        Getting Started with Collections 188

        Tips on Designing Collections 191

Avoid Explicit Schema Definitions 199

Basic Operations on Document Databases 201

    Inserting Documents into a Collection 202

    Deleting Documents from a Collection 204

    Updating Documents in a Collection 206

    Retrieving Documents from a Collection 208

Summary 210

Review Questions 210

References 211

Chapter 7 Document Database Terminology 213

Document and Collection Terms 214

    Document 215

        Documents: Ordered Sets of Key-Value Pairs 215

        Key and Value Data Types 216

    Collection 217

    Embedded Document 218

    Schemaless 220

        Schemaless Means More Flexibility 221

        Schemaless Means More Responsibility 222

    Polymorphic Schema 223

Types of Partitions 224

    Vertical Partitioning 225

    Horizontal Partitioning or Sharding 227

        Separating Data with Shard Keys 229

        Distributing Data with a Partitioning Algorithm 230

Data Modeling and Query Processing 232

    Normalization 233

    Denormalization 235

    Query Processor 235

Summary 237

Review Questions 237

References 238

Chapter 8 Designing for Document Databases 239

Normalization, Denormalization, and the Search for Proper Balance 241

    One-to-Many Relations 242

    Many-to-Many Relations 243

    The Need for Joins 243

    Executing Joins: The Heavy Lifting of Relational Databases 245

        Executing Joins Example 247

    What Would a Document Database Modeler Do? 248

        The Joy of Denormalization 249

        Avoid Overusing Denormalization 251

        Just Say No to Joins, Sometimes 253

Planning for Mutable Documents 255

    Avoid Moving Oversized Documents 258

The Goldilocks Zone of Indexes 258

    Read-Heavy Applications 259

    Write-Heavy Applications 260

Modeling Common Relations 261

    One-to-Many Relations in Document Databases 262

    Many-to-Many Relations in Document Databases 263

    Modeling Hierarchies in Document Databases 265

        Parent or Child References 265

        Listing All Ancestors 266

Summary 267

Case Study: Customer Manifests 269

    Embed or Not Embed? 271

    Choosing Indexes 271

    Separate Collections by Type? 272

Review Questions 273

References 273


Chapter 9 Introduction to Column Family Databases 277

In the Beginning, There Was Google BigTable 279

    Utilizing Dynamic Control over Columns 280

    Indexing by Row, Column Name, and Time Stamp 281

    Controlling Location of Data 282

    Reading and Writing Atomic Rows 283

    Maintaining Rows in Sorted Order 284

Differences and Similarities to Key-Value and Document Databases 286

    Column Family Database Features 286

    Column Family Database Similarities to and Differences from Document Databases 287

    Column Family Database Versus Relational Databases 289

    Avoiding Multirow Transactions 290

    Avoiding Subqueries 291

Architectures Used in Column Family Databases 293

    HBase Architecture: Variety of Nodes 293

    Cassandra Architecture: Peer-to-Peer 295

    Getting the Word Around: Gossip Protocol 296

    Thermodynamics and Distributed Database: Why We Need Anti-Entropy 299

    Hold This for Me: Hinted Handoff 300

When to Use Column Family Databases 303

Summary 304

Review Questions 304

References 305

Chapter 10 Column Family Database Terminology 307

Basic Components of Column Family Databases 308

    Keyspace 309

    Row Key 309

    Column 310

    Column Families 312

Structures and Processes: Implementing Column Family Databases 313

    Internal Structures and Configuration Parameters of Column Family Databases 313

    Old Friends: Clusters and Partitions 314

        Cluster 314

        Partition 316

    Taking a Look Under the Hood: More Column Family Database Components 317

        Commit Log 317

        Bloom Filter 319

        Consistency Level 321

Processes and Protocols 322

    Replication 322

    Anti-Entropy 323

    Gossip Protocol 324

    Hinted Handoff 325

Summary 326

Review Questions 327

References 327

Chapter 11 Designing for Column Family Databases 329

Guidelines for Designing Tables 332

    Denormalize Instead of Join 333

    Make Use of Valueless Columns 334

    Use Both Column Names and Column Values to Store Data 334

    Model an Entity with a Single Row 335

    Avoid Hotspotting in Row Keys 337

    Keep an Appropriate Number of Column Value Versions 338

    Avoid Complex Data Structures in Column Values 339

Guidelines for Indexing 340

    When to Use Secondary Indexes Managed by the Column Family Database System 341

    When to Create and Manage Secondary Indexes Using Tables 345

Tools for Working with Big Data 348

    Extracting, Transforming, and Loading Big Data 350

    Analyzing Big Data 351

        Describing and Predicting with Statistics 351

        Finding Patterns with Machine Learning 353

        Tools for Analyzing Big Data 354

        Tools for Monitoring Big Data 355

Summary 356

Case Study: Customer Data Analysis 357

    Understanding User Needs 357

Review Questions 359

References 360


Chapter 12 Introduction to Graph Databases 363

What Is a Graph? 363

Graphs and Network Modeling 365

    Modeling Geographic Locations 365

    Modeling Infectious Diseases 366

    Modeling Abstract and Concrete Entities 369

    Modeling Social Media 370

Advantages of Graph Databases 372

    Query Faster by Avoiding Joins 372

    Simplified Modeling 375

    Multiple Relations Between Entities 375

Summary 376

Review Questions 376

References 377

Chapter 13 Graph Database Terminology 379

Elements of Graphs 380

    Vertex 380

    Edge 381

    Path 383

    Loop 384

Operations on Graphs 385

    Union of Graphs 385

    Intersection of Graphs 386

    Graph Traversal 387

Properties of Graphs and Nodes 388

    Isomorphism 388

    Order and Size 389

    Degree 390

    Closeness 390

    Betweenness 391

Types of Graphs 392

    Undirected and Directed Graphs 392

    Flow Network 393

    Bipartite Graph 394

    Multigraph 395

    Weighted Graph 395

Summary 396

Review Questions 397

References 397

Chapter 14 Designing for Graph Databases 399

Getting Started with Graph Design 400

    Designing a Social Network Graph Database 401

    Queries Drive Design (Again) 405

Querying a Graph 408

    Cypher: Declarative Querying 408

    Gremlin: Query by Graph Traversal 410

        Basic Graph Traversal 410

        Traversing a Graph with Depth-First and Breadth-First Searches 412

Tips and Traps of Graph Database Design 415

    Use Indexes to Improve Retrieval Time 415

    Use Appropriate Types of Edges 416

    Watch for Cycles When Traversing Graphs 417

    Consider the Scalability of Your Graph Database 418

Summary 420

Case Study: Optimizing Transportation Routes 420

    Understanding User Needs 420

    Designing a Graph Analysis Solution 421

Review Questions 423

References 423


Chapter 15 Guidelines for Selecting a Database 427

Choosing a NoSQL Database 428

    Criteria for Selecting Key-Value Databases 429

    Use Cases and Criteria for Selecting Document Databases 430

    Use Cases and Criteria for Selecting Column Family Databases 431

    Use Cases and Criteria for Selecting Graph Databases 433

Using NoSQL and Relational Databases Together 434

Summary 436

Review Questions 436

References 437


Appendix A Answers to Chapter Review Questions 443

Appendix B List of NoSQL Databases 477

Glossary 481

9780134023212   TOC   3/27/2015


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020