Tag

ON DUPLICATE KEY UPDATE

0 views collected around this technical thread.

Sohu Tech Products
Sohu Tech Products
Jan 8, 2025 · Databases

Analysis of MySQL Deadlock Issues in Multi-threaded Scenarios

The article investigates a MySQL deadlock that arises when multiple threads concurrently execute INSERT … ON DUPLICATE KEY UPDATE for logistics cancellations, reproduces the issue on MySQL 5.7 and 8.0, analyzes InnoDB lock handling and internal mini‑transactions, and explains how batch processing of each value leads to the deadlock.

DatabaseLocking MechanismMulti-threading
0 likes · 18 min read
Analysis of MySQL Deadlock Issues in Multi-threaded Scenarios
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
Jan 31, 2023 · Databases

Useful MySQL Functions and SQL Techniques for Data Manipulation

This article presents a collection of practical MySQL functions and SQL commands—including GROUP_CONCAT, CHAR_LENGTH, LOCATE, REPLACE, NOW, INSERT…SELECT, INSERT…IGNORE, SELECT FOR UPDATE, ON DUPLICATE KEY UPDATE, SHOW CREATE TABLE, CREATE TABLE … SELECT, EXPLAIN, SHOW PROCESSLIST, and mysqldump—explaining their purposes, usage patterns, and providing concrete example queries with results.

Database AdministrationGROUP_CONCATMySQL
0 likes · 13 min read
Useful MySQL Functions and SQL Techniques for Data Manipulation
Top Architect
Top Architect
Jul 11, 2021 · Databases

Handling Duplicate Inserts in MySQL: Strategies and MyBatis Batch Example

The article discusses efficient ways to perform bulk inserts in MySQL while avoiding duplicate records, covering techniques such as INSERT IGNORE, ON DUPLICATE KEY UPDATE, INSERT…SELECT…WHERE NOT EXISTS, REPLACE INTO, and demonstrates a practical MyBatis implementation with a unique mobile_number constraint.

INSERT IGNOREMyBatisMySQL
0 likes · 5 min read
Handling Duplicate Inserts in MySQL: Strategies and MyBatis Batch Example
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