Notes

2024 Dec 09

Killing a PostgreSQL Connection

Let’s kill a PG connection

2024 Dec 09

PostgreSQL Schemas: Namespacing for Objects

For organizing objects in your DB, or setting up multi-tenancy

2024 Dec 09

PostgreSQL: Create a Read-only User/Group

Let’s create a read only group in PG and add users to it

2024 Sep 23

LRU vs FIFO (with Lazy Promotion and Quick Demotion)

Sprinkling some lazy promotion and quick demotion on FIFO

2024 Sep 22

Notes on 'A large scale analysis of hundreds of in-memory cache clusters at Twitter'

TTLs are prevalent, object sizes are small, metadata overhead can be large, object sizes change, FIFO is better than LRU, you’ve got to address memory fragmentation

2024 Jun 10

Tiered Storage via 2-Tree

Split a data-structure into two: a memory-optimized ’top’-tree and a disk optimized ‘bottom’-tree. Implement a lightweight migration protocol for hot records to move up and cold records down.

2024 Jun 09

Pointer Swizzling Buffer Pools

Switching pointers as the data pointed to moves to and fro memory and secondary storage

2024 Jun 08

Compacting Transactional Data in HyPer

Keep hot tuples uncompressed, organize cold data into chunks of columns then use lightweight compression, handle both OLTP and OLAP workloads

2024 Jun 07

Virtual Memory Hot/Cold Data Re-organization for OLTP

Hot/Cold aware memory allocation with locking of the hot region to physical memory and letting the OS swap out cold LRU pages as needed.

2024 Jun 06

Offline (but Faster and more Accurate) Classification of Hot and Cold Data

Hint, it’s based on exponential smoothing

2024 Jun 05

Anti-Caching

Track hot/cold data at tuple-level granularity. Evict LRU cold data in blocks.

2023 Jun 16

Programmatically creating a DuckDB table from an Arrow schema

PyArrow lets you create an empty table. Use that instead of custom mappings to create a DuckDB schema.

2023 May 11

Handling panics from goroutines you've spawned

It’s one thing to handle a panic that’s occured within a function. It’s an entirely different affair to handle a panic that occured within a goroutine that’s been spawned.

2023 Apr 16

Benchmarking SQLite inserts

Going from 750 writes per second to 25,0000 with a bit of configuring

2023 Jan 14

Getting started with TLA+

2022 Oct 30

End-to-End Arguments in System Design

Paper Review

2022 Oct 29

Distributed Reference Counting

2022 Sep 15

Malloc excess bytes

Space requested from malloc is a lower bound (at least or more)

2020 Jun 29

Go data-structure tricks: google/Btree

A couple of interesting approaches to concurrency and memory allocation from the Go google/btree package

2020 May 28

Speeding up unique constraint checks in PostgreSQL... or not

Are exclusion constraints using hash indexes faster than plain old uniqueness checks? Let’s find out

2020 May 27

SQL gotcha: now() vs 'now'

Make sure you’re using the correct defaults when defining columns

2020 Jan 23

Bugs From ignoring C Operator Associativity

Mistakes were made

2020 Jan 21

Go Channels Suffice for Synchronization

Or how to implement Futures/Promises in Go without having to juggle locks and waitgroups

2019 Dec 20

Golang Custom Loggers: using Postgres and Leveldb

Coupling logging to the some destination (in this case Postgres and leveldb) within the application itself isn’t by any means a good idea. Still, given the flexibility interfaces in Go provide, why not give it a try ¯\(ツ)

2019 Dec 05

Handling Bank Transactions, V2

Version 2 of a simplified Node.js-based API + PG database layer for handling a bank’s intra-account transfer operations

2019 Dec 04

Handling Bank Transactions, V1

Overview of a simplified Node.js-based API + Postgres database layer for handling a bank’s intra-account transfer operations

2019 Nov 29

Var, Let, Const and the 'commonly' expected behaviour

Javascript quirks and idiosyncracies. Or why learning a new programming language is hard when coming in with implicit assumptions from other languages

2019 Nov 20

PG Transactions & Isolation levels: Airline Seat Booking

Using the right isolation level to avoid nasty billing errors when building database-managed booking systems

2019 Nov 12

Logging with trace IDs in Node.js - pino, express and cls-hooked

A neat way to add tracing or transaction ids for each request-response cycle with as little modification to the rest of the code as possible

2019 Nov 07

Programming Pearls - Array Rotation

Programming, Pearls and a couple of interesting solutions for rotating elements within an array