Skip to content

Instantly share code, notes, and snippets.

title summary toc
Ahoy, Matey! CockroachDB on Digital Ocean
The CREATE TABLE statement creates a new table in a database.
false

Digital Ocean aims to simplify web infrastructure. CockroachDB aims to simplify database operations. Putting the two together is a natural fit––an easy-to-deploy database on easy-to-deploy servers. For anyone who's suffered the pains of attempting to scale a relational database across across a distributed deployment, this synergy should be pretty obvious (and an enormous relief).

Want more proof of how well the two play together? Look no further than our office mascot Carl who looks adorable in a costume clearly inspired by Digital Ocean's Sammy the Shark.

@sploiselle
sploiselle / crdb-do.md
Last active November 14, 2016 20:34
CRDB for DO

How To Deploy CockroachDB on Multiple Servers on Ubuntu 16.04

Introduction

CockroachDB is an open source, distributed SQL database which offers strong consistency, simple scalability, and survivability.

Setting up CockroachDB is straightforward: you install it on multiple servers, each known as a "node," and join them together to act as if they were a single entity, known as a "cluster." All of the nodes in your cluster then behave symmetrically and have access to the same data.

With this kind of design, as your needs grow, you can easily increase your system's capacity by creating new nodes and joining them to your existing cluster. For greater detail, you can read up on CockroachDB's scalability model.

I don't think TRUNCATE's CASCADE clause works (or if it does, it doesn't work like Postgres).

> CREATE TABLE reftbl (id INT PRIMARY KEY);
CREATE TABLE

> INSERT INTO reftbl VALUES (1);
INSERT 1

> CREATE TABLE fktbl (id INT REFERENCES reftbl, INDEX (id));
@sploiselle
sploiselle / indexDecimalBug.md
Last active June 14, 2016 14:39
index on decimal column EXPLAIN bug when encoding decimal

Summary

When creating an index on a column with type DECIMAL, EXPLAIN SELECT shows the indexed range it's retrieving as:

EXPLAIN SELECT decimalCol FROM t WHERE decimalCol>10;
+-------+------+------------------------------------------------------------------------------------------------+
| Level | Type |                                          Description                                           |
+-------+------+------------------------------------------------------------------------------------------------+
|     0 | scan | t@decimalIndex /<util/encoding/decimal.go:395: did not find terminator 0x0 in buffer 0x1401>-  |
+-------+------+------------------------------------------------------------------------------------------------+
@sploiselle
sploiselle / tech-writing-hw.md
Last active August 27, 2016 06:49
How to Install MediaWiki with Lighttpd on Ubuntu 14.04

How to Install MediaWiki with Lighttpd on Ubuntu 14.04

Introduction

MediaWiki is a popular open source wiki platform that can be used for public or internal collaborative content publishing. MediaWiki is used for many of the most popular wikis on the internet including Wikipedia, the site that the project was originally designed to serve.

In this guide, we will be setting up the latest version of MediaWiki on an Ubuntu 14.04 server. We will use the lighttpd web server to make the actual content available, php-fpm to handle dynamic processing, and mysql to store our wiki's data.

This guide walks you through installing your site in a subdirectory called /w/, which is how MediaWiki recommends installing it. We do not cover installing the application directly in your document root, which MediaWiki does not recommend.

@sploiselle
sploiselle / sql-delete-ident.md
Last active June 3, 2016 19:36
DELETE SQL statement IDENT clause
@sploiselle
sploiselle / contributing-via-fork.md
Last active August 2, 2017 16:43
So you want to contribute to a repo and need to make a fork...

Contribute with a Forked Repo: How to & Best Practices

If you want to work on someone else's GitHub repo, you'll start with a fork. After forking and cloning the repo locally, though, you're kind of on your own and there's a ton of Git-related work you need to do for a successful pull request.

To help you figure out this complex process, this guide walks you through making your first contribution (all the way to the point where you can start your second).

As you can probably see, it's a lengthy process. So, to keep this as brief as possible, this doc is light on conceptual details and heavy on execution.

Assumptions

The guide assumes you:

  • Have a GitHub account