Tips tagged with "Database"

Browse all tips tagged with Database.
shape
shape
shape
shape
shape
shape
shape
shape

DevOps Hard

Rolling vs Blue-Green vs Canary: Deploying Without Breaking the Database

Every deploy runs two versions at once against one database. Compare rolling, blue-green and canary, and learn expand/contract, feature flags and real rollbacks.

Kubernetes 1.33 Laravel 13 PHP 8.4
Diagram Try the challenge
9 min Read tip
Laravel Hard

Transactional Outbox in Laravel: Never Lose an Event Between Your Database and the Broker

Writing to the database and a broker in one request loses or invents events on crashes. Fix the dual-write problem with an outbox table, relay and idempotent consumers.

Laravel 13 PHP 8.4 Mysql 8.4
Diagram Try the challenge
9 min Read tip
Database Medium

Optimistic Locking With a Version Column: Fix Lost Updates in Laravel (vs lockForUpdate)

Two users save the same record and one change silently disappears. Fix lost updates with a version column, 409 responses and retries, and know when lockForUpdate fits better.

Laravel 13 PHP 8.4 Mysql 8.4
Diagram Try the challenge
10 min Read tip
Database Hard

Transaction Isolation Levels: Dirty, Non-Repeatable and Phantom Reads in MySQL and PostgreSQL

Why DB::transaction() did not stop your oversold stock: what each isolation level guarantees in MySQL vs PostgreSQL and how to pick one in Laravel.

Laravel 13 PHP 8.4 Mysql 8.4
Diagram Try the challenge
11 min Read tip
DevOps Hard

Zero-Downtime Database Migrations with Expand/Contract: Rename Columns Without Breaking Deploys

Renaming a column mid-deploy breaks old servers and queue workers. Use expand/contract, batched backfills and the right deploy order to change schemas safely.

Laravel 13 PHP 8.4 Mysql 8.4
Diagram Try the challenge
12 min Read tip
Database Medium

Offset vs Cursor Pagination: Why Page 4,000 Is Slow and How Keyset Queries Fix It

OFFSET makes deep pages slow and shuffles rows when data changes. Learn keyset queries, composite cursors, Laravel cursorPaginate and cursor-based API design.

Laravel 13 PHP 8.4 Mysql 8.4
Diagram Try the challenge
11 min Read tip
Database Medium

Database Indexes: Turn a Full Scan Into an Instant Lookup

See why a query without an index scans every row, how an index turns it into a fast lookup, and how to read EXPLAIN to tell the difference.

SQL ANSI / MySQL 8+
Diagram
2 min Read tip
PHP Easy

Preventing SQL Injection in PHP

Learn essential techniques to protect your PHP applications from SQL injection attacks.

PHP 8.0+
Diagram
2 min Read tip