blog

12020-05-24

SEAN K.H. LIAO

databases

People keep asking me career advice, here is one:

Make state someone else's problem.

Jaana Dogan (@rakyll) 2020-05-19

jepsen.io analyses arre imformative

basics

common-ish databases you might think about using

slight focus on distributed databases

isolation and consistency

Read isolation and consistency, and this and problems that may occur (the last table is a simple overview) tldr: it's confusing, moreso when transactions are involved

Simple way to think about it, add external consistency and stric serializable above serializable in isolation

CAP

Choose 2, only google can have CA

relational

The standard database.

embedded relational

not much choice here

databaseLanguageSQL syntaxIsolation (default - max)License
SQLiteCsqlitesnapshotPublic Domain
modernc.org/sqliteGosqlitesnapshotBSD 3
notes

single node relational

postgres is usually recommended

databaseLanguageSQL syntaxIsolation (default - max)License
MariaDBC/C++mysqlsnapshot - serializableGPLv2
PostgreSQLCpostgresread committed - serializablePostgreSQL License
notes

multi node relational

databaseLanguageSQL syntaxOperation modesCAPIsolation (default - max)ConsensusLicense
CockroachDBGopostgresclusterCPserializableRaftBusiness Source License
dqliteCsqliteembeddedCP?RaftLGPLv3
GaleraC/C++mysqlmaster-master-snapshot - serializable-GPLv2
rqliteC/GosqliteclusterCP?RaftMIT
Spanner?spannerhostedCAexternal consistencyPaxos-
VitessGomysqlmaster-master-read committed-Apache 2.0
YugaByte DBC/C++postgresclusterCPsnapshot - serializableRaftApache 2.0
notes

key value

Stores a blob of unindexed data.

embedded key value

databaseLanguageIsolation (default - max)License
badgerGosnapshotApache 2.0
bboltGoserializableMIT
LevelDBC++serializableBSD 3
goleveldbGoserializableBSD 2
LMDBCserializableOpenLDAP Public License
RocksDBC++read committed - snapshotGPLv2
pebbleGosnapshotBSD 3
notes

single node key value

databaseLanguageIsolation (default - max)License
RedisCserializableBSD 3
notes

multi node key value

databaseLanguageOperation modesCAPIsolation (default - max)ConsensusLicense
ConsulGoclusterCPstrict serializable - external consistencyRaftMPL 2.0
etcdGoclusterCPstrict serializable - external consistencyRaftApache 2.0
FoundationDBC/C++clusterCPStrict serializablePaxosApache 2.0
ZooKeeperJavaclusterCPread uncommitted - read committedZabApache 2.0
notes

document

Stores structured data (can be indexed). Can be used like a key-value store.

databaseLanguageOperation modesCAPIsolation (default - max)ConsensusLicense
ArangoDBC++clusterCPread uncommitted?RaftApache 2.0
CouchbaseC/C++/Erlang/Gomaster-master-read committed-Apache 2.0
CouchDBErlangclusterPAsnapshot-Apache 2.0
Fauna DBScalaclusterCPstrict serializableCalvin-
Firestore-hostedCPexternal consistency--
MongoDBC++clusterCPread uncommitted - snapshothomegrownSSPL
RethinkDBC++clusterCPread uncommitted - serializableRaftApache 2.0
notes

wide column

Stores column data contiguously (as opposed to row data contiguously). Primary usecase is analytics.

databaseLanguageOperation modesCAPIsolation (default - max)ConsensusLicense
BigTable-hostedCProw level atomic--
CassandraJavaclusterCArow level atomicPaxosApache 2.0
HBaseJavaclusterCPread committedPaxosApache 2.0
notes

graph

Stores nodes and edges, super specialized.

databaseLanguageOperation modesCAPIsolation (default - max)ConsensusLicense
DgraphGoclusterCPsnapshotRaftApache 2.0
Neo4jJavaclusterCPread committedRaftGPLv3
notes

time series

Write once, append only style. No transactions, no isolation concerns.

databaseLanguageOperation modesCAPConsensusLicense
DruidJavacluster--Apache 2.0
InfluxDBGoclusterCARaftMIT
OpenTSDBJavaclusterCPZabLGPL 2.1
TimescaleDBCsingle node-?Apache 2.0
notes