Databases
0/3 sections
0%

Databases

Databases are the foundation of virtually every application. Understanding relational, NoSQL, and distributed storage systems is critical for backend and data engineering.

Database selection is one of the most consequential architectural decisions a team makes, and one of the hardest to reverse. Choosing a relational database when document storage would have been simpler, or picking an eventually consistent NoSQL store when ACID transactions were required, creates years of workarounds and data integrity challenges.

PostgreSQL has emerged as the default choice for most new applications, and for good reason. It combines full ACID compliance, rich indexing options (B-tree, GIN, GiST, BRIN), JSON support, full-text search, and extensions like pgvector for AI embeddings into a single, battle-tested system that scales to hundreds of millions of rows.

Connection pooling is a critical operational concern that many applications handle incorrectly. Opening a new database connection for every request creates significant overhead at scale. PgBouncer, HikariCP, and application-level connection pools are essential infrastructure for any database-backed application serving meaningful traffic.

Migrations are database schema changes applied in a controlled, versioned manner. Tools like Flyway, Liquibase, and Alembic make schema evolution safe and auditable. Every change to production database schema should go through a migration file committed alongside the application code that requires it, never through ad-hoc manual changes.

Relevant to My Experience

How this topic connects to real projects and companies

Experience

Multi-database expertise across relational, NoSQL, time-series

Related Projects

1Relational Databases

    ACID Properties
  • Atomicity: all operations in a transaction succeed or all fail
  • Consistency: data must be valid according to defined rules
  • Isolation: concurrent transactions don't interfere
  • Durability: committed data persists even after failures
    Normalization
  • 1NF: atomic values, no repeating groups
  • 2NF: no partial dependency on composite primary key
  • 3NF: no transitive dependency (non-key column depends on non-key column)
  • BCNF: every determinant is a candidate key
    Indexing
  • B-Tree index: default, supports equality and range queries
  • Hash index: equality only, faster for exact matches
  • Composite index: multiple columns, order matters
  • Covering index: includes all columns needed for a query (no table lookup)
  • Partial index: index a subset of rows
    Query Optimization
  • EXPLAIN ANALYZE to read query plans
  • Avoid SELECT *, only fetch needed columns
  • Use indexes on WHERE, JOIN, and ORDER BY columns
  • Avoid functions on indexed columns in WHERE clauses
  • Paginate large result sets

2NoSQL Databases

    Document (MongoDB, Firestore)
  • JSON-like documents with flexible schema
  • Good for: content management, user profiles, catalogs
  • Query by any field, nested documents supported
    Key-Value (Redis, DynamoDB)
  • Simplest model: key maps to value
  • Redis: in-memory, sub-millisecond, supports strings/lists/sets/hashes/sorted sets
  • DynamoDB: fully managed, single-digit ms, scales to any size
  • Good for: caching, sessions, leaderboards, real-time features
    Column-Family (Cassandra, HBase)
  • Data stored by columns, not rows
  • Excellent write performance, scales horizontally
  • Good for: time-series, event logs, IoT data
  • CQL (Cassandra Query Language) looks like SQL
    Graph (Neo4j, Amazon Neptune)
  • Nodes and edges with properties
  • Native graph traversal (no expensive JOINs)
  • Good for: social networks, recommendation engines, fraud detection
  • Query language: Cypher (Neo4j)

3Transactions & Concurrency Control

ACID in Practice (PostgreSQL) ```sql -- Transaction with savepoints BEGIN;

SAVEPOINT step1; UPDATE accounts SET balance = balance - 500 WHERE id = 1;

SAVEPOINT step2; UPDATE accounts SET balance = balance + 500 WHERE id = 2;

-- Verify SELECT id, balance FROM accounts WHERE id IN (1, 2);

-- If verification fails: -- ROLLBACK TO SAVEPOINT step2;

COMMIT;

-- ── Isolation Levels ────────────────────────────────── SET TRANSACTION ISOLATION LEVEL READ COMMITTED; -- default SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; -- no non-repeatable reads SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; -- strictest, slowest

-- ── Advisory Locks (application-level) ─────────────── -- Useful for distributed locking (e.g., prevent duplicate job runs) SELECT pg_try_advisory_lock(42); -- returns true if lock acquired -- ... do work ... SELECT pg_advisory_unlock(42);

-- ── Row-level locking ───────────────────────────────── -- FOR UPDATE lock rows for modification BEGIN; SELECT * FROM inventory WHERE sku = 'ABC-123' FOR UPDATE; UPDATE inventory SET quantity = quantity - 1 WHERE sku = 'ABC-123'; COMMIT;

-- FOR SHARE allow other reads, prevent writes SELECT * FROM products WHERE id = $1 FOR SHARE; ```

Explore the Full Portfolio

This is the complete portfolio of Sufi Khan Sulaiman, a technology leader specialising in B2B commerce and digital automation. Start from the Home page for the overview, then move through two decades of career experience across FLIR Systems, Lorex Technology, and 1c Platform, and the full catalogue of project case studies spanning headless commerce migrations, AI recommendation engines, and multi-channel fulfilment systems.

The skills and certifications page maps the technical and leadership capabilities behind the work, while the articles and the knowledge base break down the thinking into actionable frameworks. For hands-on learning, the tutorials and applications sections cover practical builds from front-end fundamentals to full-stack web apps.

For consulting engagement, the expertise page outlines service offerings, the ecommerce hub covers platform architecture and automation strategy, and the ecommerce guide (PDF) is a downloadable 55-page field manual. When you are ready to talk, the contact page is the direct line.