Anatomy of a SQL Statement Execution in MySQL

Database Connection Management Applications communicate with MySQL databases through a dedicated MySQL driver that establishes TCP/IP connections. Rather than creating new connections for each request, connection pooling maintains reusable connections to avoid the overhead of repeated connection establishment and teardown. Popular Java connecti ...

Posted on Fri, 18 Sep 2026 16:08:28 +0000 by DigitalExpl0it

Understanding Core Database Concepts: Transactions, Storage Engines, and Programmability

Databases are fundamental to modern applications, providing structured ways to store and retrieve information. Beyond basic data manipulation, several advanced features ensure data integrity, optimize performance, and simplify complex operations. This article delves into critical database concepts including transactions, storage engines, views, ...

Posted on Thu, 17 Sep 2026 16:23:52 +0000 by irbrian

MySQL Logs: redo log and bin log Explained

Overview This article covers the core concepts of MySQL's transaction logs: redo log and bin log, focusing on the InnoDB storage engine. It explains the execution flow, important configuration parameters, and practical operations for viewing, managing, and recovering data using these logs. 1. InnoDB Storage Engine Execution Flow 1.1 Without a T ...

Posted on Mon, 14 Sep 2026 16:55:44 +0000 by josephicon

Resolving Spring Transaction Rollback Failures Caused by MySQL MyISAM Storage Engine

During a Java-based system refactoring project—intended to replace an aging PHP application while reusing its existing MySQL database—developers observed inconsistent transaction behavior. Despite correctly applying @Transactional on service methods and deliberately triggering unchecked exceptions (e.g., int result = 1 / 0;), database changes p ...

Posted on Sun, 13 Sep 2026 16:05:31 +0000 by southofsomewhere

MySQL InnoDB Locking Behavior with FOR UPDATE and Indexes

PrerequisitesThe FOR UPDATE clause operates exclusively within the InnoDB storage engine and requires an active transaction block (initiated with BEGIN or START TRANSACTION). By default, MySQL runs in autocommit mode. To simulate concurrent locking scenarios, autocommit must be disabled in the test sessions:mysql> SET autocommit = 0; Query O ...

Posted on Fri, 11 Sep 2026 16:55:48 +0000 by dandelo

How a Single SQL Statement Led to a Production Outage

Overview Caution is advised when using INSERT INTO SELECT statements. During a routine maintenance window, a developer needed to archive historical records from a large production table. Rather than fetching data through an application and performing batch inserts, the developer discovered that INSERT INTO SELECT could transfer data directly wi ...

Posted on Sat, 22 Aug 2026 16:25:15 +0000 by DjMikeS

Optimizing MySQL Transactions and SQL Queries

MySQL Transaction Management A database transaction serves as the fundamental unit of work in a relational database, treating a sequence of operations as a single indivisible entity. This mechanism ensures that a series of Data Manipulation Language (DML) statements—such as INSERT, UPDATE, and DELETE—execute in an all-or-nothing fashion. If any ...

Posted on Tue, 18 Aug 2026 16:34:55 +0000 by brash

Optimizing Slow COUNT() Operations in MySQL Databases

The COUNT() functon is a fundamental aggregation operation in MySQL that calculates the number of rows matching specified conditions. Despite its usefulness, performance degradation often occurs when working with large datasets. This article examines the root causes of slow COUNT() operations and presents effective optimization strategies. Perf ...

Posted on Fri, 14 Aug 2026 16:20:35 +0000 by jdaura

InnoDB Architecture and Storage Internals in MySQL

Data Files When defining a table, you can explicitly specify the storage engine. Here is an example creating a photo album table using InnoDB: CREATE TABLE `photo_album` ( `album_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Album Name', `cove ...

Posted on Thu, 06 Aug 2026 16:30:55 +0000 by natman3

InnoDB Transaction Internals: Execution Flow, Isolation Levels, and Concurrency Anomalies

Transaction Execution Flow InnoDB transactions operate through four core components: redo logs, undo logs, locking mechanisms, and MVCC (Multi-Version Concurrency Control). The transaction lifecycle consists of initiation, execution, and commit/rollback phases. ACID Properties Implementation Atomicity: Achieved through undo logs that record re ...

Posted on Fri, 31 Jul 2026 16:14:27 +0000 by The Cat