Notes
Short notes. TIL entries, one-off debugging stories, and things I want to remember next time I hit them. If you’re looking for the thinky stuff, the posts section is probably what you want.
-
TIL: git bisect run automates the bisect
Give bisect a script that exits 0 for good and non-zero for bad. It'll do the rest.
-
TIL: git reflog doesn't keep things forever
Default reflog expiry is 90 days. If you need longer safety net, configure it.
-
TIL: ltrace is strace for library calls
Different tool, adjacent niche. Handy when the bug lives in libc-level behavior, not syscalls.
-
TIL: strace -k gives you syscall backtraces
strace -k shows the stack that led to each syscall, not just the syscall itself.
-
TIL: perf-map-agent for JVM flamegraphs
Attaching perf to a JVM produces garbage unless you tell perf where the JIT-compiled symbols are.
-
TIL: Go pprof labels for attributing CPU time
pprof.Labels lets you tag goroutines and filter flamegraphs by tag.
-
TIL: jq's recurse operator finds things in arbitrarily-nested JSON
Turns out .. is jq's recursive descent, like XPath's //. Wish I'd known this years ago.
-
Notes: pgvector HNSW m parameter rule of thumb
Turns out 'just pick m=16' is a surprisingly reasonable default, and I've been overthinking it.
-
TIL: temp_buffers is a thing and default is tiny
When your query spills to disk, it's using temp_buffers. The default is 8MB, which is small.
-
TIL: EXPLAIN (ANALYZE, BUFFERS) shows cache hit ratio
The buffers flag tells you how much of your query was served from cache vs disk.
-
TIL: redis-cli MONITOR is still a footgun, not a tool
MONITOR prints every command the server handles. Very tempting. Very bad for prod.
-
TIL: sqlite3 CLI has a .mode box
No more squinting at column output — box mode gives you pretty ASCII tables.
-
TIL: pg_stat_statements_reset can take a userid
You can reset stats for just one role, instead of losing all history.
-
TIL: psql's \gexec runs the output of your query as SQL
Turns out psql has a dynamic-SQL feature built in, and I've been writing shell loops for no reason.
-
TIL: generate_series is the most underrated Postgres function
TIL you can use generate_series for date ranges, backfills, test data, and calendar tables — all without a helper.