notes

Log | Files | Refs

commit 07d4f0d33d851db6ef9768a5ea55fab8c145ddc3
parent 56ec126c7109c53885617cb1d138b4cb6fb449be
Author: ling0x <ling0x@users.noreply.github.com>
Date:   Sat, 13 Jun 2026 15:50:44 +0100

chore: format

Diffstat:
Mcommands/psql.txt | 18++++++++++++++++++
Mcommands/rust.txt | 18++++++++++++++++++
Doperating_systems/postgres/postgres_binaries.md | 3---
Aoperating_systems/postgres/postgres_binaries.txt | 90+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dwhiteboards/postgres.png | 0
5 files changed, 126 insertions(+), 3 deletions(-)

diff --git a/commands/psql.txt b/commands/psql.txt @@ -1,5 +1,23 @@ PSQL +Show hidden/system schemas: +\dnS + +Show hidden/system tables (all schemas): +\dtS *.* + +Show hidden/system tables in one schema: +\dtS pg_catalog.* + +Describe a table including system columns: +\dS+ table_name + +List all schemas via SQL: +SELECT nspname FROM pg_namespace ORDER BY nspname; + +List all tables via SQL (including system): +SELECT schemaname, tablename FROM pg_tables ORDER BY schemaname, tablename; + Connect and execute: psql -h localhost -U myuser -d mydb -c "SELECT * FROM users LIMIT 5" diff --git a/commands/rust.txt b/commands/rust.txt @@ -1,5 +1,23 @@ RUST +Enable nightly (install toolchain): +rustup toolchain install nightly + +Use nightly for one command: +cargo +nightly run + +Use nightly for current directory (creates rust-toolchain.toml): +rustup override set nightly + +Use nightly globally (default for all projects): +rustup default nightly + +Revert directory override: +rustup override unset + +Revert global default to stable: +rustup default stable + Build and run: cargo run diff --git a/operating_systems/postgres/postgres_binaries.md b/operating_systems/postgres/postgres_binaries.md @@ -1,3 +0,0 @@ -# Postgres Binaries - -<img src="/whiteboards/postgres.png" alt="Postgres Structure" width="100%"> diff --git a/operating_systems/postgres/postgres_binaries.txt b/operating_systems/postgres/postgres_binaries.txt @@ -0,0 +1,90 @@ +=============================================================================== +POSTGRES BINARIES +=============================================================================== + +------------------------------------------------------------------------------- +1. POSTGRES BINARIES & FILE STRUCTURE +------------------------------------------------------------------------------- + ++------------------------------------------------------------------+ +| Docker Container | +| +------------------------------------------------------------+ | +| | OS | | +| | | | +| | /usr/lib/postgresql/ | | +| | | | +| | +-----------------------------------------------------+ | | +| | | data | | | +| | | ------------------> /var/lib/postgresql/data | | | +| | +-----------------------------------------------------+ | | +| | | | +| | +-----------------------------------------------------+ | | +| | | lib | | | +| | | ------------------> *.so shared libraries | | | +| | +-----------------------------------------------------+ | | +| | | | +| | +-----------------------------------------------------+ | | +| | | bin --> Postgres executables: | | | +| | | postgres (server daemon) | | | +| | | psql (CLI, libpq) | | | +| | | initdb (init data dir) | | | +| | | pg_ctl (server control) | | | +| | | createdb / dropdb | | | +| | | createuser / dropuser | | | +| | | pg_dump, pg_dumpall, pg_restore | | | +| | | (backup/restore utilities) | | | +| | | ... | | | +| | +-----------------------------------------------------+ | | +| +------------------------------------------------------------+ | ++------------------------------------------------------------------+ + + +------------------------------------------------------------------------------- +2. SERVICE VS. SUPPORTING TOOLS +------------------------------------------------------------------------------- + + +--------------+ + | postgres | <-- one service, PID 1 + | (the thing | (what the container is about) + | container is | + | all about) | + +------+-------+ + +---------+--------+---------+---------+ + | | | | | + +----+----+ +--+-----+ +--+-----+ +--+-----+ + | psql | | pg_dump| |pg_upgrade| |vacuumdb| + +---------+ +--------+ +----------+ +--------+ + + many binaries - supporting tools + +Traditional Unix packaging carried into containers. + + +------------------------------------------------------------------------------- +3. COMPARATIVE PHILOSOPHY +------------------------------------------------------------------------------- + +Typical Docker: "one binary per container" + - small image, minimal attack surface + - "this container runs exactly this one app" + - you lose built-in tools, need lots of sidecars + +Postgres Docker: + - "single concern" != "literally one executable on disk" + - you can, and often should, ship a toolbox with the main service + + +------------------------------------------------------------------------------- +4. EXAMPLE RUST APP +------------------------------------------------------------------------------- + ++------------------------------------------------------------------+ +| Docker Container | +| | +| main binary --> Running as PID 1 +--------------+ | +| ops binary | CLI TOOL | | +| | debug binary| | +| | +--------------+ | +| | pipe | +| +-------------------------------> maintenance binaries | ++------------------------------------------------------------------+ diff --git a/whiteboards/postgres.png b/whiteboards/postgres.png Binary files differ.