Tag

INSERT

1 views collected around this technical thread.

Zhuanzhuan Tech
Zhuanzhuan Tech
Dec 26, 2024 · Backend Development

Analyzing MySQL 8.0 INSERT … ON DUPLICATE KEY UPDATE Deadlock and Source‑Code Investigation

This article investigates a deadlock that occurs when using INSERT … ON DUPLICATE KEY UPDATE in a multi‑threaded MySQL 8.0 environment, reproduces the issue, examines InnoDB lock logs, walks through the relevant source‑code call chain, and demonstrates how gap locks cause the deadlock.

Gap LockINSERTInnoDB
0 likes · 22 min read
Analyzing MySQL 8.0 INSERT … ON DUPLICATE KEY UPDATE Deadlock and Source‑Code Investigation
Aikesheng Open Source Community
Aikesheng Open Source Community
Sep 5, 2023 · Databases

Analyzing INSERT/REPLACE‑Induced Deadlocks in MySQL InnoDB and Prevention Strategies

This article examines how INSERT, REPLACE and INSERT … ON DUPLICATE KEY UPDATE statements can cause deadlocks in MySQL InnoDB under various scenarios, explains the underlying lock types such as GAP, NEXT‑KEY and INSERT‑INTENTION locks, and offers practical recommendations to avoid them.

INSERTInnoDBLock
0 likes · 16 min read
Analyzing INSERT/REPLACE‑Induced Deadlocks in MySQL InnoDB and Prevention Strategies
Architecture & Thinking
Architecture & Thinking
Dec 1, 2021 · Databases

Master MySQL DML: Insert, Update, Delete, and Truncate Explained

Learn the essential MySQL Data Manipulation Language commands—INSERT, UPDATE, DELETE, and TRUNCATE—including syntax variations, best practices, and step‑by‑step command‑line examples that illustrate single‑row, batch, and conditional operations, plus key differences between delete and truncate.

DELETEDMLDatabase
0 likes · 12 min read
Master MySQL DML: Insert, Update, Delete, and Truncate Explained
Top Architect
Top Architect
Oct 3, 2021 · Databases

Understanding the INSERT Locking Process in MySQL by Analyzing the Source Code

This article examines MySQL's INSERT locking behavior, explains why phantom reads do not occur under REPEATABLE READ isolation, and walks through compiling the MySQL source, debugging lock acquisition, and the role of insert‑intention and gap locks using detailed code examples and execution traces.

Gap LockINSERTInnoDB
0 likes · 18 min read
Understanding the INSERT Locking Process in MySQL by Analyzing the Source Code
Laravel Tech Community
Laravel Tech Community
Sep 7, 2021 · Databases

Handling Backslashes in MySQL INSERT and SELECT Statements

This article explains how MySQL treats backslashes as escape characters in INSERT and SELECT queries, demonstrates the effect of different numbers of backslashes through practical tests, and clarifies the double‑escaping required when using LIKE patterns.

DatabaseEscapeINSERT
0 likes · 6 min read
Handling Backslashes in MySQL INSERT and SELECT Statements
Architect's Tech Stack
Architect's Tech Stack
Aug 30, 2021 · Databases

Performance Comparison of MariaDB and MySQL: Insert and Query Benchmarks

This article presents a detailed performance benchmark comparing MariaDB 10.4.12 and MySQL 8.0.19 on an i7 Windows 10 system, covering single and batch inserts, indexed and non-indexed queries, and analyzes speed and memory usage differences between the two databases.

DatabaseINSERTMariaDB
0 likes · 6 min read
Performance Comparison of MariaDB and MySQL: Insert and Query Benchmarks
Laravel Tech Community
Laravel Tech Community
Aug 18, 2020 · Databases

How to Build INSERT Statements for Different Data Types in SQL

This article explains how to construct SQL INSERT statements for string, numeric, date, and boolean fields, demonstrates variable concatenation for dynamic values, and provides a comprehensive example that combines multiple data types into a single query.

BooleanData TypesDatabase
0 likes · 5 min read
How to Build INSERT Statements for Different Data Types in SQL
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Aug 7, 2020 · Databases

Four Common MySQL Insert Statements and Their Usage

This article explains the four frequently used MySQL data‑insertion statements—INSERT, INSERT SELECT, REPLACE INTO, and INSERT … ON DUPLICATE KEY UPDATE—detailing their syntax, options, behavior, and performance considerations for reliable database operations.

INSERTMySQLON DUPLICATE KEY UPDATE
0 likes · 7 min read
Four Common MySQL Insert Statements and Their Usage
Aikesheng Open Source Community
Aikesheng Open Source Community
Apr 9, 2020 · Databases

How an INSERT Statement Writes to Disk in MySQL InnoDB

This article explains the complete disk‑write journey of a MySQL INSERT statement, detailing the roles and order of redo log, binlog, double‑write, insert buffer, and data files, and clarifying InnoDB’s buffer‑pool and flushing mechanisms.

Buffer PoolDouble WriteINSERT
0 likes · 8 min read
How an INSERT Statement Writes to Disk in MySQL InnoDB
Aikesheng Open Source Community
Aikesheng Open Source Community
Feb 28, 2020 · Databases

How Many Disk Flushes Occur for a Single MySQL INSERT?

An experiment using pt‑tools shows that a single MySQL INSERT triggers three fsync operations on the redo log and one fdatasync on the binlog, while highlighting that flush behavior can vary due to multiple internal mechanisms.

INSERTMySQLbinlog
0 likes · 3 min read
How Many Disk Flushes Occur for a Single MySQL INSERT?
Aikesheng Open Source Community
Aikesheng Open Source Community
Apr 1, 2019 · Databases

MySQL Insert Locking, Insert‑Intention Locks, Gap Locks, and Deadlock Analysis

This article examines MySQL's insert locking behavior, including unique‑key checks, S Next‑Key locks, insert‑intention locks, gap locks, and the resulting deadlock scenarios, and provides practical recommendations for avoiding such lock conflicts in production environments.

DatabaseGap LockINSERT
0 likes · 10 min read
MySQL Insert Locking, Insert‑Intention Locks, Gap Locks, and Deadlock Analysis