0%

Get the lowdown on CockroachDB, the elastic SQL database built to handle the demands of today's data-driven world. With this practical guide, software developers, architects, and DevOps teams will discover the advantages of building on a distributed SQL database. You'll learn how to create applications that scale elastically and provide seamless delivery for end users while remaining exceptionally resilient and indestructible.

Written from scratch for the cloud and architected to scale elastically to handle the demands of cloud native and open source, CockroachDB makes it easier to build and scale modern applications. If you're familiar with distributed systems, you'll quickly discover the benefits of strong data correctness and consistency guarantees as well as optimizations for delivering ultralow latencies to globally distributed end users.

With this thorough guide, you'll learn how to:

  • Plan and build applications for distributed infrastructure, including data modeling and schema design
  • Migrate data into CockroachDB
  • Read and write data and run ACID transactions across distributed infrastructure
  • Optimize queries for performance across geographically distributed replicas
  • Plan a CockroachDB deployment for resiliency across single-region and multiregion clusters
  • Secure, monitor, and optimize your CockroachDB deployment

Table of Contents

  1. 1. Introduction to CockroachDB
    1. A Brief History of Databases
    2. Pre-relational Databases
    3. The Relational Model
    4. Implementing the relational model
    5. Transactions
    6. The SQL Language
    7. The RDBMS hegemony
    8. Enter the Internet
    9. The NoSQL movement
    10. The emergence of distributed SQL
    11. The Advent of CockroachDB
    12. CockroachDB design goals
    13. CockroachDB Releases
    14. CockroachDB in action
    15. CockroachDB at Baidu
    16. Cockroach at MyWorld
    17. CockroachDB at Bose
    18. Summary
  2. 2. CockroachDB architecture
    1. The CockroachDB Cluster Architecture
    2. Ranges and Replicas
    3. The CockroachDB software stack
    4. The CockroachDB SQL layer
    5. SQL Optimization
    6. From SQL to Key-Values
    7. Tables as represented in the KV store
    8. Column Families
    9. Indexes in the KV store
    10. Inverted Indexes
    11. The STORING clause
    12. Table Definitions and schema changes
    13. The CockroachDB Transactional layer
    14. MVCC principles
    15. Transaction workflow
    16. Write intents
    17. Parallel Commit
    18. Transaction clean up
    19. Overview of transaction flow
    20. Read/Write conflicts
    21. Clock synchronization and clock skew
    22. The CockroachDB distribution layer
    23. Meta Ranges
    24. Gossip
    25. Leaseholders
    26. Range Splits
    27. Multi-region distribution
    28. The CockroachDB Replication layer
    29. Raft
    30. Raft and Leaseholders
    31. Closed timestamps and follower reads
    32. The CockroachDB Storage layer
    33. Log Structured Merge (LSM) Trees
    34. SSTables and Bloom Filters
    35. Deletes and updates
    36. MultiVersion Concurrency Control
    37. The Block cache
    38. Summary
  3. 3. Getting Started
    1. Installation
    2. Installing CockroachDB software
    3. Creating a CockroachCloud cluster
    4. Starting a local single-node server
    5. Starting up CockroachDB in a docker container
    6. Starting up a secure server
    7. Remote connection
    8. Creating a Kubernetes cluster
    9. Using a GUI client
    10. Exploring CockroachDB
    11. Adding some data
    12. Databases and tables
    13. Issuing SQL
    14. The console
    15. Working with programming languages
    16. Connecting to CockroachDB from NodeJS
    17. Connecting to CockroachDB from Java
    18. Connecting to CockroachDB from Python
    19. Connecting to CockroachDB from Go
    20. Summary
  4. 4. CockroachDB SQL
    1. SQL LANGUAGE COMPATIBILITY
    2. QUERYING DATA WITH SELECT
    3. The SELECT list
    4. The FROM clause
    5. JOINS
    6. Anti-joins
    7. CROSS JOINS
    8. Set operations
    9. Group operations
    10. Subqueries
    11. Correlated subquery
    12. Lateral subquery
    13. The WHERE clause
    14. Common Table expressions
    15. ORDER BY
    16. Window functions
    17. Other SELECT clauses
    18. CockroachDB arrays
    19. Working with JSON
    20. Summary of SELECT
    21. CREATING TABLES AND INDEXES
    22. Column Definitions
    23. Computed Columns
    24. Datatypes
    25. Primary Keys
    26. Constraints
    27. INDEXES
    28. CREATE TABLE AS SELECT
    29. ALTERING TABLES
    30. DROPPING TABLES
    31. VIEWS
    32. INSERTING DATA
    33. IMPORT/IMPORT INTO
    34. UPDATE
    35. UPSERT
    36. DELETE
    37. TRUNCATE
    38. TRANSACTIONAL STATEMENTS
    39. BEGIN TRANSACTION
    40. SAVEPOINT
    41. COMMIT
    42. ROLLBACK
    43. SELECT FOR UPDATE
    44. AS OF SYSTEM TIME
    45. OTHER DATA DEFINITION LANGUAGE TARGETS
    46. ADMINISTRATIVE COMMANDS
    47. THE INFORMATION_SCHEMA
    48. SUMMARY
3.141.24.134