This article explains where MySQL keeps its data files, how InnoDB organizes tablespaces into segments, extents, pages and rows, details the Compact row format—including variable‑length field length lists, NULL‑value lists, and hidden fields—and clarifies the limits of VARCHAR and row‑overflow handling.
This article explains how MySQL's InnoDB engine guarantees ACID properties by describing the four components of ACID, the four isolation levels, lock granularity and types, the MVCC mechanism with version chains and read views, and the roles of undo, redo, and bin logs in ensuring atomicity, consistency, isolation, and durability.
This comprehensive guide explains how MySQL's InnoDB engine applies row‑level locks—including shared, exclusive, gap, and next‑key locks—based on different SQL statements, isolation levels, and index types, and shows how to analyze and avoid phantom reads with practical experiments.
The article details a step‑by‑step investigation of an intermittent deadlock occurring during session creation in a video‑conference system, explains how InnoDB lock types caused the conflict between DELETE and INSERT statements on the session and session_endpoint tables, reproduces the issue, debugs MySQL source code, and presents a simple code‑order fix to eliminate the deadlock.
A detailed investigation of intermittent MySQL InnoDB deadlocks occurring during video‑conference session creation, covering log extraction, lock analysis, source‑code debugging, reproducible test cases, and a simple code change that eliminates the deadlock while explaining the underlying locking mechanisms.
This article explores MySQL InnoDB table size limits, explains how page and B+ tree structures affect performance, provides scripts for generating massive test data, and derives a practical recommendation of around 20 million rows based on storage and index calculations.
Change Buffer in MySQL InnoDB (formerly insert buffer) caches modifications to secondary index pages when they are not in the buffer pool, using a B‑tree structure to batch‑apply inserts, delete‑marks, and deletes while avoiding index page splits, merges, and ensuring purge safety.
This article explains why MySQL's count(*) can be slow on InnoDB, compares different count variations, and presents practical optimization techniques such as Redis caching, second‑level caches, multithreading, reducing joins, and using ClickHouse for massive datasets.
This article walks through the complete lifecycle of a MySQL UPDATE statement, covering InnoDB page structure, tablespaces, the buffer pool, redo and undo logs, binlog, and the two‑phase commit process, illustrating each step with examples and command outputs.
This article analyzes a MySQL InnoDB lock wait timeout caused by batch INSERT operations, examines configuration parameters and slow‑query diagnostics, and presents a rewritten SQL solution that reduces execution time from over 100 seconds to under one second.
This article explains MySQL's crash recovery process, covering how the doublewrite buffer repairs corrupted pages, how redo logs are applied to restore data, and how undo tablespaces and unfinished transactions are handled during server startup.
A MySQL DBA recounts a 4‑TB InnoDB instance that stalled during startup, analyzes top, stack traces, and source code to pinpoint a bug involving truncate operations and the buf_flush_event, then presents three practical solutions—including adjusting innodb_flush_sync, using GDB to break the wait loop, or removing truncate logs—to restore normal operation.
This article explains how MySQL auto‑increment primary keys, InnoDB hidden row_id, transaction Xid, InnoDB trx_id, and the server thread_id behave when they reach their numeric limits, the consequences for data integrity, and recommended mitigation strategies.
This article explains the fundamentals of MySQL indexing, detailing how InnoDB pages, B+‑tree structures, clustered and non‑clustered indexes, and disk prefetching work together to reduce I/O operations and dramatically improve query performance.
This guide explains how to detect MySQL deadlock exceptions, retrieve and interpret InnoDB deadlock logs and binlog files, and use the information to pinpoint conflicting SQL statements and fix the underlying lock issues in live systems.
The article walks through a MySQL MGR failover incident, analyzes the InnoDB assertion failure shown in the error log, pinpoints the problematic code at row0pread.cc line 727, compares the fix in MySQL 8.0.28, and references the related bug report for future troubleshooting.
This article experimentally explores MySQL single‑table row limits, demonstrates how to generate massive test data, analyzes InnoDB page and B+Tree index structures, and derives the commonly cited 20 million‑row recommendation by calculating storage capacity and query‑performance implications.
The article explains why a seemingly non‑conflicting UPDATE on a secondary index can cause lock‑wait alerts under RC isolation, detailing the missing end‑range condition push‑down, the InnoDB row‑search flow, semi‑consistent read behavior, and differences between primary‑key and secondary‑index locking.
MVCC (Multiversion Concurrency Control) in MySQL InnoDB uses undo logs and read views to provide non‑locking snapshot reads, managing read‑write, write‑write, and read‑read concurrency, with implicit row fields and transaction IDs determining visibility across isolation levels.
This article explains MySQL's three concurrency types—read‑read, read‑write, and write‑write—describes how InnoDB uses shared/exclusive locks, MVCC snapshot reads, and ReadView metadata to ensure transaction isolation, and provides practical examples and lock‑based solutions for avoiding update loss.
This article explains MySQL's two‑layer storage engine architecture, details how the server layer prepares record metadata, and walks through a concrete InnoDB table example to show the exact memory layout and data‑exchange process between the server and storage engine.
This article explains how MySQL’s InnoDB storage engine, page size, B+‑tree index structure, and primary‑key limits combine to make roughly 20 million rows the practical ceiling for a single table, and shows how to generate massive test data and tune server settings.
This article explains MySQL InnoDB's tablespace architecture—including segments, extents, pages, and rows—and details how clustered and secondary indexes are implemented using B+ trees, comparing them with other tree structures to illustrate why B+ trees are optimal for disk‑based databases.
This article explains how MySQL's count() works across different storage engines, compares the performance of various count() forms, and offers practical strategies—such as using EXPLAIN rows, auxiliary count tables, and batch processing—to obtain accurate or approximate row counts efficiently even on massive tables.
The article details the refactoring of memory monitoring in MySQL 8.0.28, introducing a new PFS metadata structure for precise tracking of memory allocations and deallocations across various components like Buffer Pool and user variables.
This article demystifies MySQL’s processing pipeline by tracing a simple UPDATE statement through the application, service, and storage engine layers, detailing connection handling, SQL parsing, optimization, execution, buffer pool management, and the roles of undo and redo logs in ensuring data integrity.
This article explains why locating a record in a B‑Tree index is crucial for MySQL InnoDB operations, describes scan intervals, index page structures, and details the step‑by‑step binary and sequential search process used to find the first matching record, including performance optimizations.
The article investigates MySQL InnoDB lock‑wait timeouts caused by hanging transactions that lack proper commit or rollback, explains ACID and lock mechanisms, shows how stale ThreadLocal bindings let pooled threads reuse unfinished transactions, and recommends using @Transactional with robust try‑catch handling to prevent such deadlocks.
The article explains the three primary MySQL data removal commands—DELETE, TRUNCATE, and DROP—detailing their execution speed, underlying mechanisms, impact on disk space for InnoDB and MyISAM engines, and best‑practice usage such as running OPTIMIZE TABLE after DELETE.
This article explains how MySQL performs crash recovery by using Redo logs, doublewrite buffers, undo tablespace handling, transaction subsystem initialization, and the processing of active, prepared, and committed transactions to restore data pages and ensure consistency after an unexpected shutdown.
MariaDB 10.10.1 RC and 10.9.2 GA have been released, delivering a short‑term support series with numerous bug fixes and improvements for InnoDB, replication, Galera clustering, the optimizer and other core components, enhancing stability and performance for database users.
This article explains how MySQL's auto‑increment primary keys behave when they reach their maximum value, the internal InnoDB row_id mechanism, the generation of Xid and trx_id for transactions, and the handling of thread identifiers, including practical examples and code snippets.
This article explains how the height of MySQL InnoDB B+‑tree indexes determines the number of page I/O operations for different query types, provides theoretical calculations of index height, and shows practical methods using information_schema and hexdump to inspect the actual index height of tables.
This article explains how MySQL 8.0's InnoDB generates Redo logs, groups them into mini‑transactions, writes them concurrently to the log buffer, and uses log_writer and log_flusher threads together with LSN, slots, and recent_written structures to ensure durable, ordered persistence.
This article explains how MySQL InnoDB stores data in 16 KB pages, analyzes the practical limits of single‑table row counts, demonstrates data‑generation experiments, and derives the commonly cited 20 million‑row recommendation by examining B+‑tree structures, index pages, and storage parameters.
This article demystifies MySQL's Multi‑Version Concurrency Control (MVCC) by explaining its Undo Log and Read View mechanisms, showing how InnoDB implements read‑committed and repeatable‑read isolation without locking, and illustrating the process with clear examples and diagrams.
This comprehensive guide examines why slow SQL queries degrade system performance, outlines key factors such as data volume, access patterns, and processing methods, and provides concrete optimization techniques, case studies, index design principles, and advanced features like MRR and index push‑down for MySQL‑InnoDB.
This article explains the new online REDO log size adjustment feature introduced in MySQL 8.0.30, compares it with the cumbersome pre‑8.0.30 procedure, and provides step‑by‑step commands and code snippets for both legacy and modern methods.
This article explains the new MySQL 8.0.30 feature that automatically generates invisible primary keys for InnoDB tables without explicit primary keys, demonstrates how to enable and use it, discusses DDL and replication implications, and outlines related limitations and backup considerations.
This article explains how MySQL 8.0’s clone plugin changes GTID handling by storing GTID information in InnoDB undo logs, detailing the allocation of undo log segments, recording GTIDs in undo log headers, persisting them to the gtid_executed table, and coordinating purge operations.
This article explains the lifecycle of MySQL InnoDB redo logs—from generation during DML/DDL operations, through writing into the log buffer, to being flushed into the redo log file and finally persisted on disk—detailing the roles of mtr, log_writer, and log_flusher threads.
Explore the inner workings of MySQL InnoDB indexes, from row formats like Compact, Redundant, and Dynamic to page structures, B+Tree organization, and practical indexing strategies, complete with diagrams and tips for efficient query optimization and index design.
This article explains MySQL locking mechanisms—including table‑level, row‑level, shared and exclusive locks, as well as gap locks—covers the differences between MyISAM and InnoDB engines, shows how to monitor lock statistics, and provides practical optimization tips for reducing lock contention.
The article explains MySQL InnoDB's logical storage architecture, including tablespaces, pages, segments, and B+‑tree indexes, demonstrates how primary and secondary indexes are organized and accessed, and shows how to calculate index tree height and data capacity using SQL queries and hexdump analysis.
This article explains how MySQL COUNT() works under different storage engines, why counting rows becomes slow on large InnoDB tables, and presents practical methods such as using EXPLAIN rows, auxiliary count tables, batch processing, and transaction‑based updates to obtain approximate or exact row counts efficiently.
The article investigates a MySQL 5.6 instance that consumed nearly all memory on a 32 GB test server, identifies misconfigurations, excessive MyISAM file handles, and severe memory fragmentation, and demonstrates how switching to tcmalloc reduced memory usage to a stable 5 GB.
The article explains why a MySQL query with a large LIMIT offset becomes extremely slow, demonstrates the underlying I/O behavior, and shows how rewriting the query with a sub‑query that fetches primary keys first can cut execution time from seconds to milliseconds while also reducing buffer‑pool pollution.
This article explains why undo logs can grow uncontrollably in MySQL, demonstrates how to verify and accelerate undo log truncation by adjusting purge settings in MySQL 5.7, and shows the new manual undo‑tablespace management commands introduced in MySQL 8.0.
This guide explains MySQL 8.0.17's Clone Plugin—how to install it, perform local and remote clones, monitor progress via performance_schema, build replicas from cloned data, understand its internal stages, configure parameters, and compare it with XtraBackup.
This article explains how MySQL’s various auto‑increment identifiers—table AUTO_INCREMENT, InnoDB row_id, Xid, trx_id, and thread_id—behave when they reach their maximum values, the resulting errors or data overwrites, and the underlying mechanisms that cause these edge‑case behaviors.
This article explains the differences between buffers and caches, explores MySQL’s buffer pool architecture, details write‑through/write‑back strategies, and reviews key InnoDB parameters such as innodb_flush_log_at_trx_commit and innodb_flush_method for optimizing data durability and performance.
This article explains MySQL's layered design, detailing how the Server and InnoDB storage engine interact, the role of the Buffer Pool in caching data, and the functions of redo log, undo log, and binlog in ensuring durability, recovery, and replication.
This article explains the fundamental differences between buffers and caches, details MySQL’s multi‑layer buffer architecture, and examines how write‑through, write‑back, and Direct I/O affect data durability and performance through various InnoDB flush parameters.
This article examines MySQL's ON DUPLICATE KEY UPDATE clause, explains its official behavior, runs experiments with primary and multiple unique indexes, compares InnoDB row‑level locking to MyISAM table‑level locking, and highlights performance and deadlock risks that developers should avoid.
This article investigates why S‑type GAP locks appear in deadlocks under the READ COMMITTED isolation level in MySQL InnoDB, detailing the transaction workflow, lock acquisition during INSERT operations, lock inheritance after rollbacks, and reproducing the deadlock scenario with code examples and diagrams.
This article explains the concept of MySQL auto‑increment locks, describes different insertion methods and lock modes, analyzes how InnoDB allocates and manages auto‑increment IDs—including simple, bulk, and mixed inserts—and provides source‑code insights, practical experiments, and mitigation strategies for ID continuity issues.
This article explores the various reasons MySQL queries become slow—including index misuse, insufficient connection pools, small InnoDB buffer pools, and query cache limitations—while providing practical solutions such as optimizing indexes, adjusting max_connections, enlarging buffer pools, and configuring connection pools for better performance.
This article explains MySQL’s core architecture, detailing components such as connection pools, SQL interface, optimizer, and storage engine plugins, then compares MyISAM and InnoDB, and dives deep into InnoDB’s memory structures, buffer pool, adaptive hash index, tablespaces, and redo log mechanisms.
This article explains MySQL's redo log, binlog, and undo log, covering their roles in crash recovery, durability, performance optimization, log formats, two‑phase commit handling, and how they together ensure data consistency and atomicity in InnoDB.
This article explains InnoDB’s role as a MySQL storage engine, how it reads and writes data using 16 KB pages, the mechanics of row formats—especially the dynamic format—and why varchar columns are limited to 16383 characters, illustrated with SQL examples and diagrams.
This article walks through MySQL's InnoDB storage engine, explaining how pages, locality, skip‑list concepts and B+‑tree structures work together to make indexes efficient, and shows how clustered, non‑clustered and covering indexes affect query performance and I/O behavior.
This article investigates a MySQL 5.7.30 replica crash caused by an InnoDB assertion in btr0btr.cc when handling temporary tables, reproduces the issue using the MySQL Test Run framework, analyzes logs and parameters, and proposes configuration and SQL‑optimisation fixes.
This article provides a comprehensive examination of InnoDB's physical file layout, detailing page components such as the file header, page header, record storage formats, variable‑length and NULL handling, free space, page directory, file trailer, external storage pages, and the differences among row formats and compression techniques, illustrated with concrete hexdump examples and SQL statements.
This article explains MySQL 8.0.17 InnoDB locking mechanisms—including latches, row and table locks, lock modes, intention locks, their compatibility matrix, and detailed source‑code examples that illustrate how IX and X locks are acquired during record updates.
This article explains that MySQL imposes no fixed row limit, discusses the common 5‑million‑row myth and Alibaba's 2 GB recommendation, shows a Java insertion test that slows after millions of rows, and highlights how InnoDB buffer size and memory constraints affect table performance.
Facing a sudden MySQL table lock? This guide walks through real‑world troubleshooting steps—from checking table usage and process lists to inspecting InnoDB transaction and lock tables, identifying lock‑wait relationships, and safely killing offending sessions, while also explaining lock types and common metadata‑lock scenarios.
A recent poll revealed that MySQL with the InnoDB engine can support up to four billion tables, a limit dictated by the underlying file system rather than MySQL itself, and the official documentation confirms this massive capacity.
MySQL 8.0.29, released on April 26 2022, brings 160 bug fixes, several feature refinements—including string handling, stricter time formats, replication defaults, instant‑algorithm support for InnoDB, and new clone variables—while signaling the final phase of the 8.0 lifecycle and urging users of older versions to upgrade for security.
The article asks how many tables can be created in a single MySQL database using the InnoDB storage engine, prompting readers to provide the correct limit without consulting external sources and discuss the theoretical maximum based on MySQL specifications.
This article explains MySQL's lack of a hard row limit, the industry rule of thumb around 5 million rows, how InnoDB buffer size and hardware affect performance, and demonstrates a simple insertion test that reveals slowdown when a table grows too large.
This article analyzes a MySQL InnoDB lock wait timeout error, explains how gap locks cause blocked inserts and phantom reads under repeatable‑read isolation, and offers optimization strategies such as primary‑key deletions, while concluding with a recruitment invitation for the Zero technology team.
This article analyzes MySQL batch insertion performance, explains how row size, max_allowed_packet, buffer pool, transaction handling, and index design affect throughput, and presents empirical tests that suggest using roughly half of the max_allowed_packet size as the optimal batch size for large data loads.
This article demonstrates how a MySQL pagination query on a 9.5‑million‑row table that originally took over 16 seconds can be accelerated to under 0.4 seconds by moving the LIMIT condition into a subquery that selects only primary‑key IDs and then joining to retrieve the remaining columns, with detailed code and experimental verification.
This article examines common reasons why MySQL queries become slow, including index misuse, insufficient connections, and small InnoDB buffer pools, and provides practical solutions such as profiling, using EXPLAIN, adjusting connection limits, and tuning buffer pool size.
Explore MySQL's comprehensive index guide, covering basic concepts, B‑tree and B+‑tree structures, storage engine differences, index types, optimization strategies, and practical tips for designing effective primary, secondary, and composite indexes to boost query performance and reduce I/O overhead.
This article breaks down how MySQL's InnoDB engine guarantees the four ACID properties—atomicity, consistency, isolation, and durability—by leveraging undo and redo logs, the binary log, hidden transaction metadata, and MVCC with ReadView, illustrating each mechanism with concrete examples.
This article explains MySQL index fundamentals—including B‑tree, B+‑tree, hash, and ordered array structures—covers primary versus secondary indexes, describes index maintenance such as page splits and merges, examines the InnoDB change buffer, and discusses optimizer choices and cases where indexes become ineffective.
This article explains InnoDB's lock system in MySQL, covering lock granularity, intent, shared, exclusive and auto‑increment locks, row‑lock types, the underlying C++ structures, lock mode and type encoding, and the compatibility and strength matrices that govern lock acquisition and waiting.
This article explains the classification of InnoDB indexes into clustered and secondary types, describes how they are stored and accessed, and introduces optimization concepts such as back‑to‑table queries, covering indexes, and index pushdown to improve MySQL performance.
This article explains how database indexes work by first reviewing binary search trees, then introducing N‑ary trees and B+ trees, illustrating their structure, storage calculations, and search process in InnoDB to show why B+ trees are used for efficient indexing.
The article explains MySQL InnoDB lock scopes and modes—including record, gap, next‑key and insert‑intention locks—illustrates a deadlock caused by concurrent inserts on a distributed lock table, and recommends limiting concurrency, sharding by business key, and splitting lock operations into smaller sub‑transactions to avoid such deadlocks.
This article explores MySQL's client‑server interaction, connection methods, query parsing and optimization, InnoDB storage engine design, data page layout, BufferPool structures, and the free, flush, and LRU linked lists, including their challenges and optimization techniques.
This article explains how InnoDB stores data in 16 KB pages, links pages via a double‑linked list, uses page directories and primary‑key directories for binary search, and builds B+‑tree index pages to accelerate MySQL queries, covering free space, page splits, and the overall search flow.
Through a series of MySQL 5.7.26 experiments the article reveals how record‑level locks are applied to primary‑key indexes when non‑indexed columns are locked, how isolation levels (READ COMMITTED vs REPEATABLE READ) change the locking order, and why both SELECT … FOR UPDATE and UPDATE statements can block other transactions.
This article explains how InnoDB stores data on disk, the role of 16 KB pages in read/write operations, the dynamic row format’s length and NULL lists, overflow handling, and why varchar columns are limited to 16 383 characters under utf8mb4, illustrated with SQL examples.
This article explains InnoDB's storage engine mechanics, page-based I/O, the default Dynamic row format, how variable‑length fields like VARCHAR are recorded, why the maximum usable length is 16383 characters in utf8mb4, and the handling of NULL lists and overflow columns.
This article explains why MySQL’s DELETE only sets a delete‑mark, how InnoDB’s MVCC and purge thread reuse freed pages, the impact of B+‑tree storage on I/O, page merge and split mechanisms, and the proper way to rebuild tables to recover space.
This article analyzes why using SET unique_checks=0 during large MySQL imports can bypass unique‑key checks when data is not cached in the InnoDB buffer pool, explains the underlying change‑buffer mechanism, demonstrates the behavior with sysbench tests, and offers a safe workaround.
This article investigates how the innodb_ddl_threads, innodb_ddl_buffer_size, and innodb_parallel_read_threads variables introduced in MySQL 8.0.27 affect parallel DDL execution speed and resource consumption, using a 50‑million‑row test table and presenting detailed benchmark results.
Even when scanning a 200 GB InnoDB table on a server with only 100 GB RAM, MySQL streams results using a small net buffer and an optimized InnoDB buffer‑pool LRU, so the server’s memory never blows up, though I/O load remains high.
This guide explains why InnoDB full‑text search is needed, how inverted indexes work, how to create and use full‑text indexes with MATCH AGAINST in natural language, boolean, and query‑expansion modes, and how to drop them safely.
This article explains how InnoDB stores data on disk using 16 KB pages, describes the dynamic row format and its handling of variable‑length columns such as VARCHAR, and clarifies why MySQL limits VARCHAR to a maximum of 16 383 characters under utf8mb4.
This article explains MySQL's index storage structures, the difference between clustered and secondary indexes, and demonstrates six typical scenarios—wildcard LIKE, functions on indexed columns, expression calculations, implicit type conversion, left‑most rule violations in composite indexes, and OR conditions—that cause indexes to become ineffective and lead to full‑table scans.
This article walks through reproducing a MySQL deadlock in a test environment, explains how to read InnoDB status logs to pinpoint the conflicting locks, and offers practical tips to prevent deadlocks in production systems.
This article explains why a MySQL query that scans a 100‑gigabyte table and returns millions of rows does not exhaust server memory, describing the net_buffer mechanism, socket send buffer behavior, InnoDB buffer‑pool management, and the improved LRU algorithm used to keep large scans from degrading overall performance.
Full table scans on large InnoDB tables do not exhaust MySQL server memory because results are streamed in small net buffers, while InnoDB’s optimized LRU algorithm and buffer pool management ensure that massive scans minimally affect buffer pool hit rates and overall system performance.
This article explains InnoDB's Multi-Version Concurrency Control (MVCC) mechanism, detailing undo log, readview, hidden columns, visibility algorithms for RR and RC isolation levels, and includes source code snippets illustrating read view assignment and visibility checks.
This article analyzes a production MySQL deadlock caused by two identical UPDATE statements that trigger an index‑merge optimization, explains the lock interactions between the idx_status and PRIMARY indexes, and provides code‑level and MySQL‑level solutions to prevent such deadlocks.
This article explains how InnoDB’s two‑phase commit mechanism keeps the redo log and binlog logically consistent, illustrating failure scenarios, the impact on data recovery, and how the prepare‑commit split prevents inconsistencies in MySQL’s storage engine.
This article walks through MySQL’s internal query processing pipeline, the roles of the connector, parser, optimizer and executor, explains InnoDB’s redo log and binlog mechanisms with a WAL analogy, and details transaction ACID properties, isolation levels, and concurrency anomalies.