Tagged articles

replace_into

11 articles · Page 1 of 1
Top Architect
Top Architect
Jul 20, 2026 · Databases

Why You Should Stop Using Snowflake for IDs and Try a Shorter MySQL Auto‑Increment Solution

The article examines the drawbacks of using Snowflake for generating short numeric user IDs, details a MySQL auto‑increment based approach, reveals deadlock problems with REPLACE INTO, evaluates alternative schemes, and presents a final sharding‑friendly short‑ID design that meets performance and usability requirements.

DeadlockMySQLSharding
0 likes · 14 min read
Why You Should Stop Using Snowflake for IDs and Try a Shorter MySQL Auto‑Increment Solution
Code Ape Tech Column
Code Ape Tech Column
Mar 16, 2021 · Databases

How Unique Indexes Affect Auto-Increment and How to Handle Duplicate Keys in MySQL

This article explains how MySQL unique indexes influence auto‑increment behavior, compares unique constraints with primary keys, and demonstrates three techniques—INSERT IGNORE, REPLACE INTO, and INSERT … ON DUPLICATE KEY UPDATE—to avoid duplicate‑key errors, including their effects on auto‑increment values and potential deadlocks.

Duplicate KeyINSERT IGNOREMySQL
0 likes · 10 min read
How Unique Indexes Affect Auto-Increment and How to Handle Duplicate Keys in MySQL
ITPUB
ITPUB
Nov 5, 2020 · Databases

Why Does MySQL 5.7 Throw Duplicate‑Key Errors After an Auto‑Increment Upgrade?

After upgrading a critical MySQL 5.6 table to 5.7, the system began reporting duplicate‑key errors on master, replica and read‑only instances due to unexpected changes in the AUTO_INCREMENT value, prompting a deep kernel investigation, bug analysis, on‑site reproduction, and practical mitigation steps.

Duplicate KeyInnoDBMySQL
0 likes · 12 min read
Why Does MySQL 5.7 Throw Duplicate‑Key Errors After an Auto‑Increment Upgrade?
ITPUB
ITPUB
Jul 18, 2020 · Databases

Why MySQL 5.7 Auto‑Increment Duplicates After Upgrade and How to Diagnose It

After upgrading a MySQL 5.6 master to 5.7, inserts on several InnoDB tables began failing with duplicate‑key errors because the auto_increment value became inconsistent, and the article walks through kernel‑level investigation, reproduction steps, bug analysis, and practical fixes.

Bug AnalysisDuplicate KeyInnoDB
0 likes · 11 min read
Why MySQL 5.7 Auto‑Increment Duplicates After Upgrade and How to Diagnose It
Youzan Coder
Youzan Coder
Feb 20, 2019 · Databases

MySQL REPLACE INTO Deadlock: Case Study and Analysis

The article analyzes how MySQL’s REPLACE INTO statement can cause deadlocks by acquiring exclusive GAP locks during duplicate‑key handling, illustrates the issue with a step‑by‑step case study of three concurrent transactions, and recommends using pre‑check SELECT‑INSERT or serializing the statements to avoid the problem.

Case studyInnoDBLock
0 likes · 11 min read
MySQL REPLACE INTO Deadlock: Case Study and Analysis