database-lord
Architect-level database mastery for PostgreSQL, MySQL, MariaDB, MongoDB, Redis, SQLite, SQL Server, Oracle, ClickHouse. Do not use for database migration lord tasks — use `database-migration-lord` in
Files1
View on GitHubSKILL.mdskills/database-lord/SKILL.md
GitHub[SKILL] database-lord [OBJ] Design, performance-tune, optimize, and operate relational/document/key-value/analytical databases via Context7. [RULES]
- [CMD] IDs: PostgreSQL
/websites/postgresql_17source/postgres/postgres; MySQL/websites/dev_mysql_docsource/mysql/mysql-server; MariaDB/websites/mariadbsource/mariadb/server; MongoDB/websites/mongodb_manualsource/mongodb/mongo; Redis/redis/docssource/redis/redis-doc; SQLite/websites/devdocs_io_sqlitesource/sqlite/sqlite; SQL Server/microsoftdocs/sql-docs; Oracle/websites/oracle_en_database_oracle_oracle-database_19; ClickHouse/websites/clickhousesource/clickhouse/clickhouse-docs; DuckDB/duckdb/duckdb-websource/duckdb/duckdb; Meilisearch/websites/meilisearch; TiDB/pingcap/docssource/pingcap/tidb; Prisma/prisma/websource/prisma/prisma. - [CMD] Delegate deep MariaDB design, Galera, migration, and optimization questions to
mariadb-lord. - [REQ] Route every question through pillars: design, performance, optimization, operations.
- [REQ] Query Context7 with user's full question + topic (design, performance, optimization, operations).
- [REQ] Use concrete engine terms: WAL, LSN, xid, MVCC, B+Tree, LSM, page, extent, heap tuple, buffer pool, plan node, cost, selectivity, latch, deadlock.
- [REQ] Cross-engine answers query both IDs and explain design rationale.
- [REQ] Engine selection by access pattern: Postgres = default relational (extensibility, JSONB when needed); MySQL/MariaDB = read-heavy/ecosystem-fit; SQLite = embedded/edge/file-per-tenant; Redis = cache/queue/ephemeral (not primary store without persistence plan); MongoDB = document-shaped data with real scale-out need; ClickHouse/DuckDB = analytics (columnar). State the access pattern that drove the pick.
- [REQ] Schema design: normalize to 3NF then denormalize deliberately for measured read patterns; constraints enforce truth at the DB layer (NOT NULL, UNIQUE, CHECK, FK); surrogate + natural keys chosen per table; NULLs mean "unknown" — never magic sentinel values.
- [REQ] Indexing discipline: indexes exist for query patterns — composite column order follows (equality → range), leftmost-prefix rule respected; every index costs writes — audit unused ones; partial/covering indexes for hot selective queries;
EXPLAIN ANALYZEbefore and after, always. - [REQ] Transactions: isolation level chosen explicitly (read committed default; serializable where anomaly math requires), transaction scope minimal (no user think-time inside), deadlock retry handling in the app, advisory locks for mutual exclusion patterns.
- [REQ] MVCC reality: long transactions pin old versions → bloat (Postgres vacuum, autovacuum tuned not disabled); replication lag is a consistency contract — reads-after-writes must pin to primary or accept staleness explicitly.
- [REQ] Migrations: versioned, reversible or explicitly irreversible-flagged, expand-contract for zero-downtime, batched for large tables, lock-timeout aware (
lock_timeoutset), concurrent index builds on prod. - [REQ] Connection discipline: pooling (PgBouncer/proxysql) sized to real concurrency — connections ≠ parallelism; statement timeouts everywhere; idle-in-transaction reaped.
- [REQ] Operations: WAL/PITR backups (not just dumps), restore drills scheduled, replication monitored (lag + slot bloat), vacuum/maintenance automated, slow-query log reviewed on cadence.
- [REQ] Analytics split: OLTP engines don't serve dashboards — replicate to columnar (ClickHouse/DuckDB/read replica) once reporting queries hurt OLTP.
- [PROHIBIT] Storing hot-path state in the DB (queues, sessions — that's Redis/queue),
SELECT *in app code, N+1 (count queries per request — alert on >~20), unbounded connections, schema changes without lock analysis, or trusting ORM defaults blind (check generated SQL on hot paths).